Open Gabeki17 opened 9 months ago
I will answer may own question as follows:
I did not have a full understanding on the logic of fregmentation.
So the key was this section in the websocketEvent section:
WStype_FRAGMENT_BIN_START, WStype_FRAGMENT, WStype_FRAGMENT_FIN,
I would like to receive some variable every second from one ESP8266. Shot messages are arriving. but long ones are not. Like the below is cut and the rest is not even shown.
WS][0][handleWebsocket] ------- read massage frame ------- [WS][0][handleWebsocket] fin: 0 rsv1: 0 rsv2: 0 rsv3 0 opCode: 1 [WS][0][handleWebsocket] mask: 0 payloadLen: 1064 [WS][0][handleWebsocket] text: 0,cim,Nappali,ß0,hoerz,24.70,ß0,temp,24.85,ß0,hoerz,24.70,ß0,hum,50.17,ß2,cs_0,24.00,ß0,ido, párás idő várható,ß0,pres,100262.86,ß0,LK,0;1 4 24 24 0 0 1 1 0 0 0 1,ß0,debug_0,56,ß0,debug_1,1198,ß1,LA,true,ß1,LB,true,ß1,LC,true,ß1,LD,true,ß2,cs_1,1,A,ß2,cs_2,4,,ß2,cs_3,0,A,ß0,i1,,ß3,va0,ß3,vn0,Nappali,ß3,vs0,24.85,ß3,vt0,24.00,ß3,vp0,,ß3,vn2,Vendégszoba,ß3,vs2,24.16,ß3,vt2,24.00,ß3,vp2,,ß3,vn6,Háló,ß3,vs6,23.22,ß3,vt6,24.00,ß3,vp6,,ß3,vn7,Gyerekszoba,ß3,vs7,25.13,ß3,vt7,24.00,ß3,vp7,,ß4,ig2,ß4,ia0,1,ß4,ib0,05:30,ß4,ic0,24.00,ß4,id0,0,ß4,ie0,--:--,ß4,ia1,1,ß4,ib1,23:00,ß4,ic1,24.00,ß4,id1,2,ß4,ie1,--:--,ß4,ia2,2,ß4,ib2,08:00,ß4 [WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0 [WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1 [WS][0][handleWebsocketWaitFor] size: 4 cWsRXsize: 2 [WS][0][handleWebsocketWaitFor][readCb] size: 4 ok: 1 [WS][0][handleWebsocket] ------- read massage frame -------
The code for the client is as follows:
/*
*/
include
include
include
include
include
ESP8266WiFiMulti WiFiMulti; WebSocketsClient webSocket;
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
}
void setup() { // Serial.begin(921600); Serial.begin(115200);
// start heartbeat (optional) // ping server every 15000 ms // expect pong from server within 3000 ms // consider connection disconnected if pong is not received 2 times webSocket.enableHeartbeat(15000, 3000, 2);
}
void loop() { webSocket.loop(); }