]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Overview: update every second: fallback to old-style on older UnrealIRCds
authorBram Matthys <redacted>
Wed, 12 Apr 2023 12:01:26 +0000 (14:01 +0200)
committerBram Matthys <redacted>
Wed, 12 Apr 2023 12:01:26 +0000 (14:01 +0200)
api/common_api.php

index 7da12c971219ab37dc9fb5549784b8d79fb65a07..ad00ecce7040bae95f231492a5d38bd2015e5194 100644 (file)
@@ -66,10 +66,17 @@ function api_timer_loop(int $every_msec, string $method, array|null $params = nu
        $rpc->rpc()->add_timer("timer", $every_msec, $method, $params);
        if ($rpc->error)
        {
-               echo $rpc->error;
-               die;
+               /* Have to resort to old style: client-side timer */
+               while(1)
+               {
+                       $res = $rpc->query($method, $params);
+                       if (!$res)
+                               die;
+                       send_sse($res);
+               }
        }
 
+       /* New style: use server-side timers */
        for(;;)
        {
                $res = $rpc->eventloop();