ESP32进行websocket通信接收数据出错

candyliu
Posts: 3
Joined: Mon Jul 25, 2022 6:14 am

ESP32进行websocket通信接收数据出错

Postby candyliu » Mon Jul 25, 2022 6:29 am

I (104793) WEBSOCKET: WEBSOCKET_EVENT_CONNECTED
I (104953) WEBSOCKET: WEBSOCKET_EVENT_DATA
I (104953) WEBSOCKET: Received opcode=1

W (104953) WEBSOCKET: Received=<b>服务端主动向你推送:</b> <span style='font-size:20px;'>点击进入<a style='font-weight:900;font-size:16px;' href='http://www.blue-zero.com/chat/' target='_blank'>【聊天室】[围观]</a>,使用websocket开发,支持一对一私聊和一对多公聊</span>
W (104983) WEBSOCKET: Total payload length=277, data_len=277, current payload offset=0


I (104993) WEBSOCKET: WEBSOCKET_EVENT_DATA
I (104993) WEBSOCKET: Received opcode=1

W (105003) WEBSOCKET: Received=<b style='color:#ff9900;'>作者(在线)</b>:halo~,websocket开发上有什么疑问可以加我微信
W (105013) WEBSOCKET: Total payload length=106, data_len=106, current payload offset=0


I (105603) WEBSOCKET: Sending hello 0009
E (105643) TRANSPORT_WS: Error read data
E (105643) WEBSOCKET_CLIENT: Error read data
E (105643) WEBSOCKET_CLIENT: Error receive data

I (105653) WEBSOCKET_CLIENT: Reconnect after 10000 ms

乐鑫的websocket官方例程,请问大佬们,为什么发送hello 0000之后,提示会红字?例程就改了URI,其他的都没改。。

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: ESP32进行websocket通信接收数据出错

Postby ESP_Gargamel » Mon Jul 25, 2022 11:49 am

IDF 版本?URI?

candyliu
Posts: 3
Joined: Mon Jul 25, 2022 6:14 am

Re: ESP32进行websocket通信接收数据出错

Postby candyliu » Tue Jul 26, 2022 1:30 am

版本:esp-idf-v4.4,
URI:ws://121.40.165.18:8800

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32进行websocket通信接收数据出错

Postby ESP_YJM » Tue Jul 26, 2022 6:19 am

错误的原因是你这个服务器主动断开的,我使用 websocket 工具也是这个现象。服务器回复:十分抱歉,由于服务器资源紧张,今日【接收消息】已超过50次(每日重置),现已断开。<br/>请咨询作者【微信:yaohuang46】来获取自定的客户端【不断开】的长连接测试。

candyliu
Posts: 3
Joined: Mon Jul 25, 2022 6:14 am

Re: ESP32进行websocket通信接收数据出错

Postby candyliu » Tue Jul 26, 2022 8:51 am

ESP_YJM wrote:
Tue Jul 26, 2022 6:19 am
错误的原因是你这个服务器主动断开的,我使用 websocket 工具也是这个现象。服务器回复:十分抱歉,由于服务器资源紧张,今日【接收消息】已超过50次(每日重置),现已断开。<br/>请咨询作者【微信:yaohuang46】来获取自定的客户端【不断开】的长连接测试。
你好,再次试了下没有提示服务器资源紧张还是会报错。这也是因为ESP32自己断开吗?

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32进行websocket通信接收数据出错

Postby ESP_YJM » Wed Jul 27, 2022 3:31 am

你可以抓包看下,你也可以在异常处打印 errno 值确认。

Who is online

Users browsing this forum: No registered users and 63 guests