0
$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
11月15日提问

查看全部 2 个回答

0

提示已经很明确了

推广链接