服务器wss协议,使用mqtt组件连接服务端(mqtt的wss协议)报错

在尝试使用mqtt组件连接到wss协议的服务器时,遇到编码错误异常。错误提示表明不能发送数组类型的数据,需转换为字符串。错误发生在`WorkermanProtocolsWebsocket.php`的第236行。此问题涉及到工作进程、连接管理和数据发送等环节。
摘要由CSDN通过智能技术生成

$remote_server = new Client('websocket://s.sportnanoapi.com:443', [

'client_id'=>'MqttClient_'.self::msectime(),

'ssl' => true,

'username' => env('NAMI_USER'),

'password' => env('NAMI_SECRET'),

'connect_timeout' => 10,

'keepalive' => 20,

'clean_session' => true,

]);

Exception: You can't send(array) to client, you need to convert it to a string. in /var/www/59hongdan/vendor/workerman/workerman/Protocols/Websocket.php:236

Stack trace:

#0 /var/www/59hongdan/vendor/workerman/workerman/Connection/TcpConnection.php(344): Workerman\Protocols\Websocket::encode(Array, Object(Workerman\Connection\AsyncTcpConnection))

#1 /var/www/59hongdan/vendor/workerman/mqtt/src/Client.php(452): Workerman\Connection\TcpConnecti

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值