php sec-websocket-accept,workerman作为wss客户端提示Sec-WebSocket-Accept not found

哥,我的也是这样,请问怎么设置?

// 以websocket协议连接远程websocket服务器

$wssUrl = 'ws://tts-api.xfyun.cn:443/v2/tts?authorization=YXBpX2tleT0iNGMzZDc2MjBlOTI3MmYyNmI1OTY0ZWM0ZmI0MGVkYjQiLGFsZ29yaXRobT0iaG1hYy1zaGEyNTYiLGhlYWRlcnM9Imhvc3QgZGF0ZSByZXF1ZXN0LWxpbmUiLHNpZ25hdHVyZT0iRWtFeENmRVlmVVQ3VVI5OEVuTEdoR1U2YmNqQ0RnV3QvdEVUSTJobHdJZz0i&date=Sat, 07 Nov 2020 13:32:33 GMT&host=tts-api.xfyun.cn';

$ws_connection = new AsyncTcpConnection($wssUrl);

// 设置以ssl加密方式访问,使之成为wss

$ws_connection->transport = 'sslv3';

// 连上后发送hello字符串

$ws_connection->onConnect = function($connection) use($frame){

$connection->send(json_encode($frame));

};

// 远程websocket服务器发来消息时

$ws_connection->onMessage = function($connection, $data){

echo "recv: $data\n";

};

// 连接上发生错误时,一般是连接远程websocket服务器失败错误

$ws_connection->onError = function($connection, $code, $msg){

echo "error: $msg\n";

};

// 当连接远程websocket服务器的连接断开时

$ws_connection->onClose = function($connection){

echo "connection closed\n";

};

// 设置好以上各种回调后,执行连接操作

$ws_connection->connect();

返回:

Sec-WebSocket-Accept not found. Header:

HTTP/1.1 400 Bad Request

Date: Sat, 07 Nov 2020 13:31:17 GMT

Content-Type: text/html; charset=UTF-8

Content-Length: 220

Connection: close

Server: kong/1.3.0

connection closed

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值