From: Bram Matthys Date: Mon, 8 May 2023 06:27:26 +0000 (+0200) Subject: Return from $rpc->eventloop() after 2 seconds instead of 10. X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-rpc-php.git/commitdiff_plain/HEAD Return from $rpc->eventloop() after 2 seconds instead of 10. This so keepalive-like packets can be sent to the browser by the webpanel every 2 seconds instead of 10 seconds (for better explanation see webpanel) --- diff --git a/lib/Connection.php b/lib/Connection.php index bcd38d1..11d4a62 100644 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -115,6 +115,7 @@ class Connection */ public function eventloop(): object|array|bool|null { + $this->connection->setTimeout(2); /* lower timeout for socket loop */ $starttime = microtime(true); try { $reply = $this->connection->receive(); @@ -137,6 +138,8 @@ class Connection return NULL; } + $this->connection->setTimeout(10); /* set timeout back again */ + $reply = json_decode($reply); if (property_exists($reply, 'result')) {