workerman作为wss客户端提示Sec-WebSocket-Accept not found

 
问题同:https://wenda.workerman.net/question/3379 ,但该哥们说找到是自己的问题了,我这边还是有问题麻烦各位大佬帮忙看看问题所在.
 
在浏览器端可连接,原ws地址是:wss://ws.coincap.io/prices?assets=bitcoin,ethereum,ws://ws.coincap.io:443/prices?assets=bitcoin,ethereum,这种URL形式也试过的.
require_once __DIR__.'/vendor/autoload.php';
use Workerman\Connection\AsyncTcpConnection;
use Workerman\Worker;

$worker = new Worker('text://0.0.0.0:6161');

$worker->onWorkerStart = function() {
// 以websocket协议连接远程websocket服务器
/*$context = [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false
]
];
$con = new AsyncTcpConnection("ws://ws.coincap.io/prices?assets=bitcoin,ethereum", $context);*/
/*$con = new AsyncTcpConnection("ws://ws.coincap.io/prices?assets=bitcoin,ethereum");
$con->transport = 'sslv3';*/
$con = new AsyncTcpConnection("ws://ws.coincap.io:443/prices?assets=bitcoin,ethereum");
//$con->transport = 'ssl';
// 注册连接上后的事件
$con->onConnect = function($con){
echo "connected\n";
};
$con->onWebSocketConnect = function($con, $http_buffer){
echo $http_buffer;
};
// 远程websocket服务器发来消息时
$con->onMessage = function($con, $data){
echo "recv: $data\n";
};
// 连接上发生错误时,一般是连接远程websocket服务器失败错误
$con->onError = function($con, $code, $msg){
echo "error: $msg\n";
};
// 当连接远程websocket服务器的连接断开时
$con->onClose = function($con){
echo "connection closed\n";
$con->reconnect(1);
};
// 设置好以上各种回调后,执行连接操作
$con->connect();
};

Worker::runAll();

 
报错信息为:
Press Ctrl+C to stop. Start success.
connected
Sec-WebSocket-Accept not found. Header:
HTTP/1.1 400 Bad Request
Server: cloudflare
Date: Sat, 08 Dec 2018 14:38:41 GMT
Content-Type: text/html
Content-Length: 269
Connection: close
CF-RAY: -
connection closed
脚本执行方式:
php client.php start
已邀请:

rockman1107

赞同来自:

找到问题所在了,原来是端口号443跟$con->transport = 'ssl' 要同时设置,估计犯我这错的人比较少,汗颜

pgzgn

赞同来自:

老哥能帮忙看一看么,xhell已经显示成功了,但是没有任何的输出,

要回复问题请先登录注册