• 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
阅读 640
评论
    4 个回答
    • 742

    连接断开了吧