while (true
) { if (connection_status() !== CONNECTION_NORMAL ||
connection_aborted()) { break;
} $currentHash =
$hasher->
hash();
// If hash has changed, tell the browser to reload.
if ($currentHash !==
$appHash) { $appHash =
$currentHash;
$this->
sendEvent('reload',
['time' =>
date('Y-m-d H:i:s'
)]);
break;
} if (mt_rand(1, 10
) > 8
) { $this->
sendEvent('ping',
['time' =>
date('Y-m-d H:i:s'
)]);
} sleep(1
);
} } /**
* Send an event to the browser.
*/