服务端采用websocket协议,采用了LVS负载均衡策略,客户端连接LVS机器,再由LVS分发给任意一台服务器。但每次客户端连接上来后都会立刻断开,一步步追踪到的了下面这行代码(vendor/workerman/workerman/Connection/TcpConnection.php): // Check connection closed. if ($buffer === '' || $buffer === ...
先上代码: start_gateway.php中代码 $gateway->onConnect = function($connection) { $connection->onWebSocketConnect = function($connection) { echo 'onWebSocketConnect ',microtime(true),PHP_EOL; ...