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
阅读 311
评论 2019-11-15 提问
    4 个回答

    用什么方式启动的

    评论 赞赏 2019-11-20
      putyy
      • 1
      • 新人请关照

      提示已经很明确了

      评论 赞赏 2019-11-21
        宇润
        • 687

        连接断开了吧

        评论 赞赏 2019-12-22
          Sgenmi
          • 1
          • 新人请关照

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

          评论 赞赏 2019-12-24
            撰写回答

            登录后参与交流、获取后续更新提醒