Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid WebSocket frame: invalid UTF-8 sequence #818

Closed
zekageri opened this issue May 9, 2023 · 1 comment
Closed

Invalid WebSocket frame: invalid UTF-8 sequence #818

zekageri opened this issue May 9, 2023 · 1 comment

Comments

@zekageri
Copy link

zekageri commented May 9, 2023

I have a websocket server written in node js.
I'm sending text packets from an esp32.

When the server gets a packet it immidiately throws an error:

[Socket] -  Error: Invalid WebSocket frame: invalid UTF-8 sequence
May 9 01:50:37 PM      at Receiver.dataMessage (/opt/render/project/src/node_modules/ws/lib/receiver.js:532:18)
May 9 01:50:37 PM      at Receiver.getData (/opt/render/project/src/node_modules/ws/lib/receiver.js:459:17)
May 9 01:50:37 PM      at Receiver.startLoop (/opt/render/project/src/node_modules/ws/lib/receiver.js:158:22)
May 9 01:50:37 PM      at Receiver._write (/opt/render/project/src/node_modules/ws/lib/receiver.js:84:10)
May 9 01:50:37 PM      at writeOrBuffer (node:internal/streams/writable:392:12)
May 9 01:50:37 PM      at _write (node:internal/streams/writable:333:10)
May 9 01:50:37 PM      at Writable.write (node:internal/streams/writable:337:10)
May 9 01:50:37 PM      at Socket.socketOnData (/opt/render/project/src/node_modules/ws/lib/websocket.js:1278:35)
May 9 01:50:37 PM      at Socket.emit (node:events:513:28)
May 9 01:50:37 PM      at addChunk (node:internal/streams/readable:324:12) {
May 9 01:50:37 PM    code: 'WS_ERR_INVALID_UTF8',
May 9 01:50:37 PM    [Symbol(status-code)]: 1007
May 9 01:50:37 PM  }

And my esp disconnects as soon as the server throws an error like this.
What could be the problem?

When i send the packet i write it to the Serial to verify its ok.

webSocket.sendTXT(messageString,msgLength);
Serial.printf("\n[SOCKET] - %s\n", messageString);
[SOCKET] - Connected
[SOCKET] - {"header":{"from":"hsh","to":"client","key":27483611521760,"controll":"setHeader"},"data":"connect"}
[SOCKET] - Disconnected
@Links2004
Copy link
Owner

see #814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants