<?php
-include "../common.php";
+include "../inc/common.php";
+
+if(session_status() !== PHP_SESSION_ACTIVE) session_start();
if (!isset($_SESSION['id']))
die("Access denied");
session_write_close();
// Only now make the connection (this can take a short while)
-include "../connection.php";
+include "../inc/connection.php";
// Server Side Events
header('Content-Type: text/event-stream');
{
$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);
}
}
if (!$res)
die;
send_sse($res);
+ usleep($every_msec * 1000);
}
}
{
$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);
}
}