有用户连接时报错,怎么解决啊

mahaiyin
  • 4
新手上路,请多包涵
$server = new Swoole\WebSocket\Server('0.0.0.0', 8899);
$server->on('open', function ($server, $req) {
});
$server->on('message', function ($server, $frame) {
    $server->push($frame->fd, $frame->data);
});
$server->on('WorkerStart', function ($server, $worker_id) {
    while (true) {
        foreach ($server->connections as $fd) {
            $server->push($fd, '111111111111');
        }
    }
});
$server->on('close', function ($s, $fd) {
});
$server->start();
Warning: SwooleWebSocketServer::push(): the connected client of connection[1] is not a websocket client or closed in /obj/server.php on line 12
PHP Warning: SwooleWebSocketServer::push(): the connected client of connection[1] is not a websocket client or closed in /obj/server.php on line 12
回复
阅读 911
4 个回答

用什么方式启动的

putyy
  • 1
新手上路,请多包涵

提示已经很明确了

连接断开了吧

Sgenmi
  • 1
新手上路,请多包涵

可能是没有心跳,断开了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏