Host working, but unhost not working

Hi,

I’m debugging a piece of PHP software that calls the Twitch API for hosting channels. The hosting part works perfectly fine and is basically executing a /host command in my channel’s chat. The unhosting works similarly by executing “/unhost” in chat, but somewhat the hosted channel doesn’t get unhosted. I verified that the flow of commands worked correctly by executing them in a telnet session to Twitch’s IRC server (to be precise I first have to telnet through a proxy), then executing the host and unhost commands. I also verified that these commands work manually, and I’m pretty sure I’m not hitting any of the usual hosting limits (4 per 30 minutes).

Does anybody have an idea about what could cause such a behavior?

Thank you.

So I found the solution to this problem and it’s something extremely odd: I replaced the call to the PhP-defined function unhost() that was doing the unhosting with the effective actions (write on a socket connected to Twitch’s IRC server and type the /unhost command; I litterally unfolder the sequence of function calls to replace the line with an instruction). The functions host() and unhost() were doing exactly the same thing, except the messages being sent are host and unhost, and for some unknown reason the second one was not working.

If anyone more knowledgeable in Twitch API and/or PhP has any idea of why that is, I’d very much appreciate the enlightenment :slight_smile:

Sometimes the commands don’t work without sending them multiple times. It’s been a problem for as long as I can remember.

I’d double-triple check first that you’re actually sending the correct “/unhost” command over the connection though.

What is weird is that there’s no functional difference between the old code (calls a function unhost() than calls a function sendMessage() that writes on the socket the .unhost private message; the same code was used successfully to host a given Twitch channel) and the new code (writes directly on the socket).

I will try to duplicate the call to unhost to see if it makes a difference. Thanks for chiming in :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.