コード例 #1
0
ファイル: Event.php プロジェクト: songsihan/doudizhu
 /**
  * 当用户断开连接时触发
  * @param int $client_id 连接id
  */
 public static function onClose($client_id, $message = '')
 {
     if ($message) {
         $data = json_decode($message, true);
         if ($data && is_array($data)) {
             foreach ($data as $uid) {
                 GameDao::rmReadyPlayer($uid);
                 GameDao::rmInGamePlayer($uid);
                 //                   echo $uid." isIn:".GameDao::isInGame($uid)."\n";
             }
         }
     }
     // 向所有人发送 @see http://gatewayworker-doc.workerman.net/gateway-worker-development/send-to-all.html
     //       GateWay::sendToAll("$client_id logout");
     //       GateWay::sendToAll(json_encode(array('type'=>'closed', 'id'=>$client_id)));
 }