isSseAuthenticated($_GET["user_id"], $_GET[$SSE_KEY_KEY])) { respondStatus(403); } $sse = new SSE(); //create a libSSE instance $sse->exec_limit = 600; //the execution time of the loop in seconds. Default: 600. Set to 0 to allow the script to run as long as possible. $sse->sleep_time = 5; //The time to sleep after the data has been sent in seconds. Default: 0.5. $sse->client_reconnect = 10; //the time for the client to reconnect after the connection has lost in seconds. Default: 1. $sse->use_chunked_encoding = false; //Use chunked encoding. Some server may get problems with this and it defaults to false $sse->keep_alive_time = 600; //The interval of sending a signal to keep the connection alive. Default: 300 seconds. $sse->allow_cors = true; //Allow cross-domain access? Default: false. If you want others to access this must set to true. $sse->addEventListener('change', new YourEventHandler());//register your event handler $sse->start();//start the event loop ?>