You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* These strings must not be used as event names, as they have a special meaning.
*/
const RESERVED_EVENTS = [
"connect", // used on the client side
"connect_error", // used on the client side
"disconnect", // used on both sides
"disconnecting", // used on the server side
"newListener", // used by the Node.js EventEmitter
"removeListener", // used by the Node.js EventEmitter
];
as you can see we are missing disconnecting event. Now flutter apps send disconnecting event as EVENT type: 2, but correct type is 1.
As a result, server side socket.io crash:
Error: invalid payload
at Decoder.decodeString (/home/app/node_modules/socket.io-parser/build/cjs/index.js:238:23)
at Decoder.add (/home/app/node_modules/socket.io-parser/build/cjs/index.js:141:27)
at Client.ondata (/home/app/node_modules/socket.io/dist/client.js:182:26)
at Socket.emit (node:events:517:28)
at Socket.onPacket (/home/app/node_modules/engine.io/build/socket.js:120:22)
at WebSocket.emit (node:events:517:28)
at WebSocket.onPacket (/home/app/node_modules/engine.io/build/transport.js:94:14)
at WebSocket.onData (/home/app/node_modules/engine.io/build/transport.js:103:14)
at WebSocket.<anonymous> (/home/app/node_modules/engine.io/build/transports/websocket.js:20:19)
at WebSocket.emit (node:events:517:28)
at Receiver.receiverOnMessage (/home/app/node_modules/engine.io/node_modules/ws/lib/websocket.js:1178:20)
at Receiver.emit (node:events:517:28)
at Receiver.dataMessage (/home/app/node_modules/engine.io/node_modules/ws/lib/receiver.js:528:14)
at Receiver.getData (/home/app/node_modules/engine.io/node_modules/ws/lib/receiver.js:446:17)
at Receiver.startLoop (/home/app/node_modules/engine.io/node_modules/ws/lib/receiver.js:148:22)
at Receiver._write (/home/app/node_modules/engine.io/node_modules/ws/lib/receiver.js:83:10)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Receiver.Writable.write (node:internal/streams/writable:337:10)
at Socket.socketOnData (/home/app/node_modules/engine.io/node_modules/ws/lib/websocket.js:1272:35)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
at readableAddChunk (node:internal/streams/readable:308:9)
at Socket.Readable.push (node:internal/streams/readable:245:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
Error: invalid payload, type (2): \"[\"disconnecting\",\"transport close\"]\n
The text was updated successfully, but these errors were encountered:
Just to add some more info to whoever is searching for this issue. I think this happens at least since socket.io 4.6.2 (when they started using socket.io-parser 4.2.4 with the RESERVED_EVENTS listed above).
And just to clarify: should we upgrade to socket io client-dart 3.x beta? or is it something we could avoid by downgrading socket.io to 4.6.1 (and/or force socket.io-parser 4.2.3)?
Hi, library is no longer compatible with latest socket.io. (4.7.4)
In latest version of socket.io there is list reserved events : https://github.com/socketio/socket.io-parser/blob/9f76ea22b41feeade0c8819dbf3c16fd07becc2a/lib/index.ts#L11
In this library list of events looks like this:
as you can see we are missing
disconnecting
event. Now flutter apps senddisconnecting
event as EVENT type: 2, but correct type is 1.As a result, server side socket.io crash:
Error: invalid payload, type (2): \"[\"disconnecting\",\"transport close\"]\n
The text was updated successfully, but these errors were encountered: