49107199@qq.com 3 anos atrás
pai
commit
5a02233e69
1 arquivos alterados com 16 adições e 16 exclusões
  1. 16 16
      app/api/imsocket/imsocket.php

+ 16 - 16
app/api/imsocket/imsocket.php

@@ -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)
     {