database->conn); /** * Server-Sent Events (SSE) */ $sse = new Sender(); $last_change_in_timetable; while (!connection_aborted()) { $time = $timeMapper->getLatest(); if ($time) { $last_change_in_timetable = $time->date->getTimestamp(); if ($last_time == NULL || $last_change_in_timetable > $last_ajax_call) { $sse->send($timeMapper->getAll()); } } sleep(1); }