X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/69e00a0c673ac39cb2992d37d8d3fc171c781531..c06c1713af2db485d55a91073bbc5b63b6aa8c0b:/api/common_api.php diff --git a/api/common_api.php b/api/common_api.php index ad00ecc..2224b0d 100644 --- a/api/common_api.php +++ b/api/common_api.php @@ -1,5 +1,7 @@ eventloop(); if (!$res) + { + /* Output at least something every timeout (10) seconds, + * otherwise PHP may not + * notice when the webclient is gone. + */ + echo "\n"; continue; + } send_sse($res); } } @@ -73,6 +82,7 @@ function api_timer_loop(int $every_msec, string $method, array|null $params = nu if (!$res) die; send_sse($res); + usleep($every_msec * 1000); } } @@ -81,7 +91,14 @@ function api_timer_loop(int $every_msec, string $method, array|null $params = nu { $res = $rpc->eventloop(); if (!$res) + { + /* Output at least something every timeout (10) seconds, + * otherwise PHP may not + * notice when the webclient is gone. + */ + echo "\n"; continue; + } send_sse($res); } }