Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.87k stars 555 forks source link

ESP8266 don't connect to Socket io server. #724

Open lutakrystal305 opened 2 years ago

lutakrystal305 commented 2 years ago

My error:

15:00:17.519 -> .[WS-Client] Websocket Version: 2.3.6
15:00:17.566 -> [wsIOc] found EIO=4 disable EIO ping on client
15:00:17.566 -> [WS-Client] connect ws...
15:00:20.483 -> [WS-Client] connected to myvxk.sse.codesandbox.io:8080.
15:00:20.483 -> [WS-Client][sendHeader] sending header...
15:00:20.483 -> [WS-Client][sendHeader] handshake GET /socket.io/?EIO=4&transport=polling HTTP/1.1
15:00:20.483 -> Host: myvxk.sse.codesandbox.io:8080
15:00:20.483 -> Connection: keep-alive
15:00:20.483 -> Origin: file://
15:00:20.483 -> User-Agent: arduino-WebSocket-Client
15:00:20.483 -> 
15:00:20.483 -> [write] n: 168 t: 7322
15:00:20.530 -> [WS-Client][sendHeader] sending header... Done (21136us).
15:00:20.623 -> [WS-Client][handleHeader] RX: HTTP/1.1 301 Moved Permanently
15:00:20.623 -> [WS-Client][handleHeader] RX: Date: Wed, 15 Dec 2021 08:00:23 GMT
15:00:20.623 -> [WS-Client][handleHeader] RX: Transfer-Encoding: chunked
15:00:20.670 -> [WS-Client][handleHeader] RX: Connection: keep-alive
15:00:20.670 -> [WS-Client][handleHeader] RX: Cache-Control: max-age=3600
15:00:20.670 -> [WS-Client][handleHeader] RX: Expires: Wed, 15 Dec 2021 09:00:23 GMT
15:00:20.670 -> [WS-Client][handleHeader] RX: Location: https://myvxk.sse.codesandbox.io/socket.io/?EIO=4&transport=polling
15:00:20.707 -> [WS-Client][handleHeader] RX: Server: cloudflare
15:00:20.707 -> [WS-Client][handleHeader] RX: CF-RAY: 6bde2351f8e26e2e-HKG
15:00:20.707 -> [WS-Client][handleHeader] RX: alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
15:00:20.754 -> [WS-Client][handleHeader] Header read fin.
15:00:20.754 -> [WS-Client][handleHeader] Client settings:
15:00:20.754 -> [WS-Client][handleHeader]  - cURL: /socket.io/?EIO=4
15:00:20.754 -> [WS-Client][handleHeader]  - cKey: j46YsLd8Cl4BL8wjeeq/eg==
15:00:20.754 -> [WS-Client][handleHeader] Server header:
15:00:20.754 -> [WS-Client][handleHeader]  - cCode: 301
15:00:20.754 -> [WS-Client][handleHeader]  - cIsUpgrade: 0
15:00:20.754 -> [WS-Client][handleHeader]  - cIsWebsocket: 1
15:00:20.801 -> [WS-Client][handleHeader]  - cAccept: 
15:00:20.801 -> [WS-Client][handleHeader]  - cProtocol: arduino
15:00:20.801 -> [WS-Client][handleHeader]  - cExtensions: 
15:00:20.801 -> [WS-Client][handleHeader]  - cVersion: 0
15:00:20.801 -> [WS-Client][handleHeader]  - cSessionId: 
15:00:20.801 -> [WS-Client][handleHeader] still missing cSessionId try socket.io V3
15:00:20.801 -> [WS-Client][handleHeader] socket.io json: 0
15:00:20.801 -> [WS-Client][handleHeader] RX: 0
15:00:20.801 -> [WS-Client][handleHeader] Header error (0)
15:00:25.538 -> [WS-Client][handleClientData] header response timeout.. disconnecting!
15:00:25.538 -> [WS-Client] client disconnected.

My code;

WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  display.clear();
  display.drawString(0, 0, "Connected");
  display.display();
  socketIO.begin("myvxk.sse.codesandbox.io", 8080, "/socket.io/?EIO=4");
  socketIO.onEvent(socketIOEvent);

My server:

import express from "express";
// add "type": "module" in package.json
//import pkg from "express";
import cors from "cors";
import pkg1 from "body-parser";
import cookieParser from "cookie-parser";
import { createServer } from "http";
import { Server } from "socket.io";
const app = express();
const http = createServer(app);
const io = new Server(http, {

});
//const { use, get } = pkg;
const { json, urlencoded } = pkg1;

app.use(json()); // for parsing application/json
app.use(urlencoded({ extended: true }));

app.use(cookieParser());

app.use(cors());

io.on("connection", (socket) => {
  console.log("user connected");
  socket.on("disconnect", () => {
    console.log("user disconnect");
  });
  socket.on("ON_LED", (data) => {
    console.log("on_led");
    socket.emit("CONFIRM_ON_LED", 0);
  });
  socket.on("OFF_LED", (data) => {
    console.log("of_led");
    socket.emit("CONFIRM_OFF_LED", 1);
  });
  socket.on("ON_TEMP", () => {
    console.log("on_temp");
    socket.emit("CONFIRM_ON_TEMP");
  });
  socket.on("ON_BITCOIN", () => {
    socket.on("CONFIRM_ON_BITCOIN");
  });
});
// function timeout() {
//   setTimeout(function () {
//     io.emit("reply", "A message from server");
//     timeout();
//   }, 5000);
// }
//create a server object:

http.listen(8080);

app.get("/", (req, res) => {
  res.send("hello");
});
Can someone help me debug this? Thank <3  @Links2004 
shrynshjn commented 2 years ago

Hi, I am facing the same issue. Can you tell me which server of socket.io server are you using with nodejs?

lutakrystal305 commented 2 years ago

Can you tell me which server of socket.io server are you using with nodejs?

I don't know what you mean. My source code is above.

shrynshjn commented 2 years ago

I meant the socket.io version, in your package.json

lutakrystal305 commented 2 years ago

it's 4.4.0

shrynshjn commented 2 years ago

@Links2004 I am also facing a similar issue There is a difference between the nodejs socket.io-client and our socket.io client when connecting to the server, I enabled the debug logs on the server and this is what i found

this is the output when my client on esp8266 tries to connect to the server

socket.io:client client close with reason transport close
engine intercepting request for path "/socket.io/" 
engine handling "GET" http request "/socket.io/?EIO=4&transport=polling"
engine handshaking client "vUyavXTFz6QNPAvQAAAm"
socket.io:server incoming connection with id vUyavXTFz6QNPAvQAAAm
engine upgrading existing transport
socket.io-parser decoded 2["event_name",{evet_payload}] as {"type":2,"nsp":"/","data":["event_name",{event_payload}]}
socket.io:client no socket for namespace /
socket.io-parser decoded 0/socket.io as {"type":0,"nsp":"/socket.io"}
socket.io:client creation of namespace /socket.io was denied
socket.io:client writing packet {"type":4,"nsp":"/socket.io","data":{"message":"Invalid namespace"}}
socket.io-parser encoding packet {"type":4,"nsp":"/socket.io","data":{"message":"Invalid namespace"}}
socket.io-parser encoded {"type":4,"nsp":"/socket.io","data":{"message":"Invalid namespace"}} as 4/socket.io,{"message":"Invalid namespace"}

and this is the output when nodejs client tries to connect to the server

engine intercepting request for path "/socket.io/"
engine handling "GET" http request "/socket.io/?&EIO=4&transport=polling&t=Nt1BNXi&b64=1"
engine handshaking client "t0yBdeJIojlI86c8AAAa"
socket.io:server incoming connection with id t0yBdeJIojlI86c8AAAa
engine intercepting request for path "/socket.io/"
engine handling "POST" http request "/socket.io/?&EIO=4&transport=polling&t=Nt1BNaq&b64=1&sid=t0yBdeJIojlI86c8AAAa"
engine setting new request for existing client
socket.io-parser decoded 0 as {"type":0,"nsp":"/"}
socket.io:client connecting to namespace /
socket.io:namespace adding socket to nsp /
socket.io:socket socket connected - writing packet
socket.io:socket join room s115O5lyrTDIuiJgAAAb
socket.io:client writing packet {"type":0,"data":{"sid":"s115O5lyrTDIuiJgAAAb"},"nsp":"/"}
socket.io-parser encoding packet {"type":0,"data":{"sid":"s115O5lyrTDIuiJgAAAb"},"nsp":"/"}
socket.io-parser encoded {"type":0,"data":{"sid":"s115O5lyrTDIuiJgAAAb"},"nsp":"/"} as 0{"sid":"s115O5lyrTDIuiJgAAAb"}
engine upgrading existing transport
engine intercepting request for path "/socket.io/"
engine handling "GET" http request "/socket.io/?&EIO=4&transport=polling&t=Nt1BNb3&b64=1&sid=t0yBdeJIojlI86c8AAAa"
engine setting new request for existing client
socket.io-parser decoded 2["event_name",""] as {"type":2,"nsp":"/","data":["event_name",""]}
socket.io:socket got packet {"type":2,"nsp":"/","data":["event_name",""]}
socket.io:socket emitting event ["event_name",""]
socket.io:socket dispatching an event ["evemt+ma,e",""]Z

theres an additional POST request in the nodejs client, there isnt a similar request from the esp8266 client. And esp8266 client is also not able to connect to a namespace, I added the socket.io namespace to try, but it was the same without adding any namespace connection request.

I am using socket.io @3.1.2.

shrynshjn commented 2 years ago

Can you try degrading your socket.io version, as 4.4.0 uses engine-io version 5? I am not sure if that makes any difference though

shrynshjn commented 2 years ago

I tried upgrading mine, its the same issue on the server side still

shrynshjn commented 2 years ago

This is my esp8266 debug output

[WS-Client] connect ws...
[WS-Client] connected to "domain":"port".
[WS-Client][sendHeader] sending header...
[WS-Client][sendHeader] handshake GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: "domain":"port"
Connection: keep-alive
Origin: file://
User-Agent: arduino-WebSocket-Client

[write] n: 236 t: 135556
[WS-Client][sendHeader] sending header... Done (29168us).
[WS-Client][handleHeader] RX: HTTP/1.1 200 OK
[WS-Client][handleHeader] RX: Content-Type: text/plain; charset=UTF-8
[WS-Client][handleHeader] RX: Content-Length: 97
[WS-Client][handleHeader] RX: Date: Thu, 16 Dec 2021 03:56:19 GMT
[WS-Client][handleHeader] RX: Connection: keep-alive
[WS-Client][handleHeader] RX: Keep-Alive: timeout=5
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader]  - cURL: /socket.io/?EIO=4
[WS-Client][handleHeader]  - cKey: T131fqLsnq8k4jH9u35Pow==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader]  - cCode: 200
[WS-Client][handleHeader]  - cIsUpgrade: 0
[WS-Client][handleHeader]  - cIsWebsocket: 0
[WS-Client][handleHeader]  - cAccept: 
[WS-Client][handleHeader]  - cProtocol: arduino
[WS-Client][handleHeader]  - cExtensions: 
[WS-Client][handleHeader]  - cVersion: 0
[WS-Client][handleHeader]  - cSessionId: 
[WS-Client][handleHeader] still missing cSessionId try socket.io V3
[WS-Client][handleHeader] socket.io json: 0{"sid":"C_ggis07gPULMhSdAAAG","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS-Client][handleHeader]  - cSessionId: C_ggis07gPULMhSdAAAG
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader]  - cURL: /socket.io/?EIO=4
[WS-Client][handleHeader]  - cKey: T131fqLsnq8k4jH9u35Pow==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader]  - cCode: 200
[WS-Client][handleHeader]  - cIsUpgrade: 0
[WS-Client][handleHeader]  - cIsWebsocket: 0
[WS-Client][handleHeader]  - cAccept: 
[WS-Client][handleHeader]  - cProtocol: arduino
[WS-Client][handleHeader]  - cExtensions: 
[WS-Client][handleHeader]  - cVersion: 0
[WS-Client][handleHeader]  - cSessionId: C_ggis07gPULMhSdAAAG
[WS-Client][handleHeader] found cSessionId
[WS-Client][sendHeader] sending header...
[WS-Client][sendHeader] handshake GET /socket.io/?EIO=4&transport=websocket&sid=C_ggis07gPULMhSdAAAG HTTP/1.1
Host: "domain":"port"
Connection: Upgrade
    Upgrade: websocket
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: OTYKgyLyE/pH3nrTWyhqcw==
    Sec-WebSocket-Protocol: arduino
    Origin: file://
    User-Agent: arduino-WebSocket-Client

[write] n: 385 t: 135860
[WS-Client][sendHeader] sending header... Done (43230us).
[WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS-Client][handleHeader] RX: Upgrade: websocket
[WS-Client][handleHeader] RX: Connection: Upgrade
[WS-Client][handleHeader] RX: Sec-WebSocket-Accept: L0YgCBT6Lg6nwd2GrQ57V8sXm/0=
[WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: arduino
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader]  - cURL: /socket.io/?EIO=4
[WS-Client][handleHeader]  - cKey: OTYKgyLyE/pH3nrTWyhqcw==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader]  - cCode: 101
[WS-Client][handleHeader]  - cIsUpgrade: 1
[WS-Client][handleHeader]  - cIsWebsocket: 1
[WS-Client][handleHeader]  - cAccept: L0YgCBT6Lg6nwd2GrQ57V8sXm/0=
[WS-Client][handleHeader]  - cProtocol: arduino
[WS-Client][handleHeader]  - cExtensions: 
[WS-Client][handleHeader]  - cVersion: 0
[WS-Client][handleHeader]  - cSessionId: C_ggis07gPULMhSdAAAG
[WS-Client][handleHeader] Websocket connection init done.
[WS][0][headerDone] Header Handling Done.
[wsIOc] Connected to url: /socket.io/?EIO=4
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 6 headerToPayload: 0
[WS][0][sendFrame] text: 2probe
[WS][0][sendFrame] pack to one TCP package...
[write] n: 12 t: 136045
[WS][0][sendFrame] sending Frame Done (3845us).
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 leng[readCb] n: 
    [readCb] n: 
    [readCb] n: 
    [readCb] n: 
    [readCb] n: 
    [readCb] n: th: 1 headerToPayload: 1
[WS][0][sendFrame] text: 5
[write] n: 7 t: 136067
[WS][0][sendFrame] sending Frame Done (3491us).
[write] n: 6 t: 136076
[write] n: 2 t: 136079
[write] n: 109 t: 136083
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 12 headerToPayload: 0
[WS][0][sendFrame] text: 40/socket.io
[WS][0][sendFrame] pack to one TCP package...
[write] n: 18 t: 136113
[WS][0][sendFrame] sending Frame Done (5634us).
[write] n: 6 t: 136124
[write] n: 2 t: 136128
[write] n: 53 t: 136133
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 136150
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 6
[readCb] n: 6 t: 136174
[WS][0][handleWebsocket] text: 3probe
[wsIOc] get pong
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 136187
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 44
[readCb] n: 44 t: 136210
[WS][0][handleWebsocket] text: 44/socket.io,{"message":"Invalid namespace"}
[wsIOc] Socket.IO Message Type 4 (34) is not implemented
[wsIOc] get text: 44/socket.io,{"message":"Invalid namespace"}
[write] n: 6 t: 144124
[write] n: 2 t: 144129
[write] n: 53 t: 144133
[write] n: 6 t: 152125
[write] n: 2 t: 152129
[write] n: 53 t: 152133
[write] n: 6 t: 160126
[write] n: 2 t: 160130
[write] n: 53 t: 160134
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 160616
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 1
[readCb] n: 1 t: 160639
[WS][0][handleWebsocket] text: 2
[wsIOc] get ping send pong (3)
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 1 headerToPayload: 0
[WS][0][sendFrame] text: 3
[WS][0][sendFrame] pack to one TCP package...
[write] n: 7 t: 160665
[WS][0][sendFrame] sending Frame Done (3804us).
[write] n: 6 t: 168127
[write] n: 2 t: 168131
[write] n: 53 t: 168135
[write] n: 6 t: 176128
[write] n: 2 t: 176132
[write] n: 53 t: 176136
[WS-Client] sending HB ping
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 9 mask: 1 length: 0 headerToPayload: 0
[write] n: 6 t: 180072
[WS][0][sendFrame] sending Frame Done (3733us).
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 180115
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 10
[WS][0][handleWebsocket] mask: 0 payloadLen: 0
[WS][0][handleWebsocket] get pong ()
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 180629
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 8
[WS][0][handleWebsocket] mask: 0 payloadLen: 0
[WS][0][handleWebsocket] get ask for close. Code: 1000

[WS][0][handleWebsocket] clientDisconnect code: 1000
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 8 mask: 1 length: 2 headerToPayload: 0
[WS][0][sendFrame] pack to one TCP package...
[write] n: 8 t: 180677
[WS][0][sendFrame] sending Frame Done (3955us).
[WS-Client] client disconnected.

the server closes the connection cause the client has not joined any namespace yet

socket.io:client no socket for namespace /
socket.io:client no namespace joined yet, close the client
socket.io:client forcing transport close
socket.io:client client close with reason forced close
socket.io:client client close with reason forced server close
shrynshjn commented 2 years ago

Okay looks like, my issue can be solved by

socketIO.send(sIOtype_CONNECT, "/");

in the connect event. This joins the default namespace.

lutakrystal305 commented 2 years ago

How to fix this? @Links2004 rep me, pls.


Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x4000bdc8
EXCVADDR: 0x0000005b

Decoding stack results
0x40201123: socketIOEvent(socketIOmessageType_t, unsigned char*, unsigned int) at C:\Dev\Arduino\project1/project1.ino line 47
0x4020cb74: std::_Function_handler ::_M_invoke(std::_Any_data const&, socketIOmessageType_t&&, unsigned char*&&, unsigned int&&) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 289
0x40100590: delayMicroseconds(unsigned int) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_wiring.cpp line 209
0x4020cbb1: SocketIOclient::runIOCbEvent(socketIOmessageType_t, unsigned char*, unsigned int) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 617
0x40207e48: HardwareSerial::flush() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\HardwareSerial.cpp line 125
0x40201a34: SocketIOclient::handleCbEvent(WStype_t, unsigned char*, unsigned int) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\SocketIOclient.cpp line 239
0x402099e8: __esp_yield() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 116
0x40202648: WebSockets::handleWebsocketPayloadCb(WSclient_t*, bool, unsigned char*) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 466
0x40201a70: SocketIOclient::runCbEvent(WStype_t, unsigned char*, unsigned int) at C:\Dev\Arduino\libraries\arduinoWebSockets\src/SocketIOclient.h line 100
0x40202b75: WebSocketsClient::messageReceived(WSclient_t*, WSopcode_t, unsigned char*, unsigned int, bool) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSocketsClient.cpp line 466
0x40202738: WebSockets::handleWebsocketPayloadCb(WSclient_t*, bool, unsigned char*) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 491
0x40100b70: check_poison_block(umm_block*) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_poison.c line 95
0x4020cc10: std::_Function_handler  1>, std::_Placeholder2>, unsigned char*))(WSclient_t*, bool, unsigned char*)> >::_M_invoke(std::_Any_data const&, WSclient_t*&&, bool&&) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0/functional line 414
0x401000f1: std::function ::operator()(WSclient_t*, bool) const at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 617
0x40202190: WebSockets::readCb(WSclient_t*, unsigned char*, unsigned int, std::function ) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 654
0x40100744: malloc(size_t) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\heap.cpp line 242
0x40202a3f: WebSockets::handleWebsocketCb(WSclient_t*) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 303
0x402099e8: __esp_yield() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 116
0x40201b68: std::_Function_handler  1>, std::_Placeholder2>, unsigned char*))(WSclient_t*, bool, unsigned char*)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 268
0x4020cbec: std::_Function_handler  1>, std::_Placeholder2>, unsigned char*))(WSclient_t*, bool, unsigned char*)> >::_M_invoke(std::_Any_data const&, WSclient_t*&&, bool&&) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 289
0x4020b378: uart_wait_tx_empty(uart_t*) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\uart.cpp line 569
0x40202ab5: std::_Function_handler   (WebSockets*, unsigned int, std::_Placeholder1>, std::_Placeholder2>)> >::_M_invoke(const std::_Any_data &, WSclient_t *&&, bool &&) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 367
0x40100525: millis() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_wiring.cpp line 193
0x401000f1: std::function ::operator()(WSclient_t*, bool) const at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 617
0x40202190: WebSockets::readCb(WSclient_t*, unsigned char*, unsigned int, std::function ) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 654
0x40100744: malloc(size_t) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\heap.cpp line 242
0x40202253: WebSockets::handleWebsocketWaitFor(WSclient_t*, unsigned int) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 303
0x40201bc0: std::_Function_handler   (WebSockets*, unsigned int, std::_Placeholder1>, std::_Placeholder2>)> >::_M_manager(std::_Any_data &, const std::_Any_data &, std::_Manager_operation) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 268
0x40202a74: std::_Function_handler   (WebSockets*, unsigned int, std::_Placeholder1>, std::_Placeholder2>)> >::_M_invoke(const std::_Any_data &, WSclient_t *&&, bool &&) at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 289
0x40205e88: BearSSL::WiFiClientSecureCtx::connected() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 260
0x40202887: WebSockets::handleWebsocketCb(WSclient_t*) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 391
0x40207915: OLEDDisplay::drawStringInternal(short, short, char*, unsigned short, unsigned short) at C:\Dev\Arduino\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays\src\OLEDDisplay.cpp line 1030
0x40100b70: check_poison_block(umm_block*) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_poison.c line 95
0x40100c05: check_poison_neighbors(umm_heap_context_t*, uint16_t) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_local.c line 71
0x40100d11: umm_free_core(umm_heap_context_t*, void*) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc\umm_malloc.cpp line 549
0x40202af9: WebSockets::handleWebsocket(WSclient_t*) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSockets.cpp line 339
0x40203b41: WebSocketsClient::handleClientData() at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSocketsClient.cpp line 579
0x401007b0: vPortFree(void*, char const*, int) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_heap_select.h line 85
0x40201476: showTemp(float, float) at C:\Dev\Arduino\project1/project1.ino line 83
0x4021d5ac: mem_free at core/mem.c line 236
0x40217192: pbuf_free_LWIP2 at core/pbuf.c line 786
0x40100525: millis() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_wiring.cpp line 193
0x40209a86: __yield() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 116
0x40206618: BearSSL::WiFiClientSecureCtx::_run_until(unsigned int, bool) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 474
0x40100c05: check_poison_neighbors(umm_heap_context_t*, uint16_t) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_local.c line 71
0x40100c05: check_poison_neighbors(umm_heap_context_t*, uint16_t) at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\umm_malloc/umm_local.c line 71
0x40206a40: BearSSL::WiFiClientSecureCtx::available() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 415
0x40205e88: BearSSL::WiFiClientSecureCtx::connected() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 260
0x4020cce8: BearSSL::WiFiClientSecure::connected() at c:\users\thai\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/shared_ptr_base.h line 1324
0x40203b8e: WebSocketsClient::clientIsConnected(WSclient_t*) at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSocketsClient.cpp line 532
0x40203e8e: WebSocketsClient::loop() at C:\Dev\Arduino\libraries\arduinoWebSockets\src\WebSocketsClient.cpp line 276
0x40201476: showTemp(float, float) at C:\Dev\Arduino\project1/project1.ino line 83
0x40201a8e: SocketIOclient::loop() at C:\Dev\Arduino\libraries\arduinoWebSockets\src\SocketIOclient.cpp line 176
0x40201631: loop() at C:\Dev\Arduino\project1/project1.ino line 127
0x40209b08: loop_wrapper() at C:\Users\Thai\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line `201` 
guotingchao commented 1 year ago

I have the same problem