|
|
@@ -20,22 +20,22 @@ class imsocket extends Server
|
|
|
|
|
|
$connection->send(json_encode($msg));
|
|
|
}
|
|
|
- public function onWorkerStart($worker){
|
|
|
- //设置一个每50秒运转一次的定时器
|
|
|
- Timer::add(50, function()use($worker){
|
|
|
- $time_now = time();
|
|
|
- foreach($worker->connections as $connection) {
|
|
|
- // connection还没收到过音讯,则lastMessageTime设置为当前时时间
|
|
|
- if (empty($connection->lastConnTime)) {
|
|
|
- $connection->lastConnTime = $time_now;
|
|
|
- continue;
|
|
|
- }
|
|
|
- if ($time_now - $connection->lastConnTime > HEARTBEAT_TIME) {
|
|
|
- $connection->close();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+// public function onWorkerStart($worker){
|
|
|
+// //设置一个每50秒运转一次的定时器
|
|
|
+// Timer::add(50, function()use($worker){
|
|
|
+// $time_now = time();
|
|
|
+// foreach($worker->connections as $connection) {
|
|
|
+// // connection还没收到过音讯,则lastMessageTime设置为当前时时间
|
|
|
+// if (empty($connection->lastConnTime)) {
|
|
|
+// $connection->lastConnTime = $time_now;
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// if ($time_now - $connection->lastConnTime > HEARTBEAT_TIME) {
|
|
|
+// $connection->close();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
|
|
|
public function onMessage($connection,$data)
|
|
|
{
|