有2个问题
1 服务端的链接格式为ws://123.207.167.163:9010/ajaxchattest
demo上的ws客户端,跑不通,send后收不到服务端回复消息。
2 然后比如说ws的服务端,在客户端第一次链接后会发送一条消息,但是workman客户端触发不了onMessage的事件
贴代码
<?php use Workerman\Worker; use Workerman\Connection\AsyncTcpConnection; require_once __DIR__.'/../../../Workerman/Autoloader.php'; $worker = new Worker(); $worker->onWorkerStart = function($worker) { $con = new AsyncTcpConnection('ws://121.40.165.18:8088'); // $con = new AsyncTcpConnection('ws://123.207.167.163:9010/ajaxchattest'); $con->onConnect = function($con) { // $params = ''; // $con->send($params); }; $con->onMessage = function($con, $data) { echo "recv: $data\n"; }; $con->onClose = function($con) { echo "connection closed\n"; }; $con->onError = function($con, $code, $msg) { echo "Error code:$code msg:$msg\n"; }; $con->connect(); }; Worker::runAll();
[attach]696[/attach] 测试正常,没有你说的情况
prod-live-entry.playbattlegrounds.com对Sec-WebSocket-Key有严格的检查,请更新下workerman的版本,已经做了修复
@1:更新到3.4.6,问题解决,真的非常感谢,非常感谢!
在线测试结果
贴代码
[attach]696[/attach]
测试正常,没有你说的情况
prod-live-entry.playbattlegrounds.com对Sec-WebSocket-Key有严格的检查,请更新下workerman的版本,已经做了修复
@1:更新到3.4.6,问题解决,真的非常感谢,非常感谢!
在线测试结果