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

no idea, with socket.io below 4.0.2 it works, with 4.1.x it throws this Error: unknown packet type NaN #3922

Closed
p3x-robot opened this issue May 13, 2021 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@p3x-robot
Copy link

Sorry, it is a simple error:

Uncaught Error: unknown packet type NaN
    at Decoder.decodeString (index.js:151)
    at Decoder.add (index.js:105)
    at Manager.ondata (manager.js:199)
    at Socket.Emitter.emit (index.js:145)
    at Socket.onPacket (socket.js:399)
    at WS.Emitter.emit (index.js:145)
    at WS.onPacket (transport.js:105)
    at WS.onData (transport.js:98)
    at WebSocket.ws.onmessage (websocket.js:111)
@p3x-robot p3x-robot added the bug Something isn't working label May 13, 2021
@p3x-robot p3x-robot changed the title no idea, with socket.io 4.0.2 it works, with 4.1.x it throws this error no idea, with socket.io below 4.0.2 it works, with 4.1.x it throws this error May 13, 2021
@jinkwon
Copy link

jinkwon commented May 14, 2021

I have same issue :(

@Him-2C
Copy link

Him-2C commented May 16, 2021

Me to

@darrachequesne
Copy link
Member

I could indeed reproduce, we will publish a fix as soon as possible.

@p3x-robot p3x-robot changed the title no idea, with socket.io below 4.0.2 it works, with 4.1.x it throws this error no idea, with socket.io below 4.0.2 it works, with 4.1.x it throws this Error: unknown packet type NaN May 17, 2021
@Him-2C
Copy link

Him-2C commented May 17, 2021

This case has error when handle on emit.

@p3x-robot
Copy link
Author

This case has error when handle on emit.

sorry, by example? i am not totally understanding what you are saying, can you show a code that causes this error?

@p3x-robot
Copy link
Author

it is an interesting issue, because i have an app that works perfectly with v4.1, then i got older systems that crash on v4.1 but below v4.1 it works perfectly.

darrachequesne added a commit that referenced this issue May 17, 2021
Using `[email protected]` with `[email protected]` would lead to
the following error:

> Uncaught Error: unknown packet type NaN

Because the packet would be encoded twice, resulting in "undefined".

See also:

- socketio/socket.io-adapter@5579d40
- dc381b7

Related:

- #3922
- #3927
@darrachequesne
Copy link
Member

This should be fixed in [email protected]. Could you please check?

@darrachequesne darrachequesne added this to the 4.1.2 milestone May 17, 2021
@p3x-robot
Copy link
Author

p3x-robot commented May 18, 2021

yes, i can verify the error is gone and it works as expected.

dzad pushed a commit to dzad/socket.io that referenced this issue May 29, 2023
Using `[email protected]` with `[email protected]` would lead to
the following error:

> Uncaught Error: unknown packet type NaN

Because the packet would be encoded twice, resulting in "undefined".

See also:

- socketio/socket.io-adapter@5579d40
- socketio@aafc3d8

Related:

- socketio#3922
- socketio#3927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants