Open MitoCodeGithub opened 1 year ago
Hey @MitoCodeGithub, it seems like as you missed to setup the timeout handling in your code:
$ts3->notifyRegister("textprivate");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTextmessage", "onTextmessage");
TeamSpeak3_Helper_Signal::getInstance()->subscribe('serverqueryWaitTimeout', "onWaitTimeout");
$ts3->clientGetByName("Mito")->message("Write to me");
while(1) $ts3->getAdapter()->wait();
function onTextmessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host) {
echo "Client " . $event["invokername"] . " sent textmessage: " . $event["msg"];
}
function onWaitTimeout(int $idle_seconds, ServerQuery $serverquery)
{
if ($serverquery->getQueryLastTimestamp() < time() - 260) {
echo 'Sending keep-alive.';
$serverquery->request('clientupdate');
}
}
If you don't handle the timeouts, the connection will timeout after the default 300 seconds (5 minutes).
I don't know, how you have implemented this feature into your website, so I can't tell you what you need to change to avoid any kind of timeouts on the website. The above code will only avoid timeouts of the bot itself, when nothing happens for a specific time.
Hi,
I used the example of Creating a simple bot that listens for events but when I write to the bot I always get a timeout on my website.
I'm using Cloudflare, could that be the problem?