返回实时聊天wor......登陆

实时聊天workerman

@smash2019-07-02 15:49:1246

foreach ($sockets as $socket) {       
        if ($socket == $this->master) {
            socket_accept($this->master);
           
             self::connect($client);
             continue;
            }
       
        } else {
           
            $bytes = @socket_recv($socket, $buffer, 2048, 0);

            if ($bytes < 9) {
                $recv_msg = $this->disconnect($socket);
            } else {
                // 如果此客户端还未握手,执行握手逻辑
                if (!$this->sockets[(int)$socket]['handshake']) {
                    self::handShake($socket, $buffer);
                    continue;
                } else {
                    $recv_msg = self::parse($buffer);
                }
            }
            $this->broadcast($msg);
        }
    }
}

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送
  • PHP中文网