]>
Commit | Line | Data |
---|---|---|
57190f59 VP |
1 | <?php |
2 | include "../common.php"; | |
3 | include "../connection.php"; | |
4 | ||
5 | ||
6 | session_start(); | |
7 | if (!isset($_SESSION['id'])) | |
8 | die("Access denied"); | |
9 | ||
10 | // Close the session now, otherwise other pages block | |
11 | session_write_close(); | |
12 | ||
13 | // Set a valid header so browsers pick it up correctly. | |
14 | //header('Content-type: text/html; charset=utf-8'); | |
15 | header("Content-type: application/json"); | |
16 | ||
17 | // Explicitly disable caching so Varnish and other upstreams won't cache. | |
18 | header("Cache-Control: no-cache, must-revalidate"); | |
19 | ||
20 | // Setting this header instructs Nginx to disable fastcgi_buffering and disable | |
21 | // gzip for this request. | |
22 | header('X-Accel-Buffering: no'); | |
23 | ||
24 | // No time limit | |
25 | set_time_limit(0); | |
26 | ||
27 | // Send content immediately | |
28 | ob_implicit_flush(1); | |
29 | ||
30 | // Eh.. yeah... | |
31 | ob_end_flush(); | |
32 | ||
33 | // If we use fastcgi, then finish the request now (UNTESTED) | |
34 | if (function_exists('fastcgi_finish_request')) | |
35 | fastcgi_finish_request(); | |
36 | ||
37 | $sources = ["!debug","all"]; | |
38 | $rpc->log()->subscribe($sources); | |
39 | echo $rpc->error; | |
40 | for(;;) | |
41 | { | |
42 | $res = $rpc->eventloop(); | |
43 | if (!$res) | |
44 | continue; | |
45 | echo json_encode($res)."\n"; | |
46 | } |