gateway worker 如何发起 websocket client。我这里需要开发一个基于gatewayWorker 的服务,但是还需要调用第三方的websocket。
未找到那里可以做为websocket client
发起websocket连接代码类似
$con = new AsyncTcpConnection('ws://echo.websocket.org:80'); // websocket握手成功后 $con->onWebSocketConnect = function(AsyncTcpConnection $con, ) { $con->send('hello'); }; // 当收到消息时 $con->onMessage = function(AsyncTcpConnection $con, $data) { echo $data; }; $con->connect();
具体参考手册 https://www.workerman.net/doc/workerman/faq/as-wss-client.html
发起websocket连接代码类似
具体参考手册 https://www.workerman.net/doc/workerman/faq/as-wss-client.html