-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Getting three frames instead of two between client/server #2444
Comments
I know it has been nearly 9 months since you posted this, but did you solve your problem? I also have a seemingly unexplained third frame appearing with almost identical content to yours. And I'm trying to work out how to get rid of it. |
I did figure this out for my case and it's not a bug, it's how socket.io is designed to match a binary frame to a message name. When you emit a binary type message with a string name, socket.io sends two frames, one for the string name and one for the binary message. That's how it knows which handler to use on the server. It's a convenience of being able to name a binary message with a string, at the cost of an extra frame. For us this was to much, so we opted to go a pure websocket route and we use the first byte of a binary message as an "op code" to route the message to the appropriate handler on the server. Then we only have to send on frame per binary message. One library that helps a lot with this is SchemaPack: /~https://github.com/phretaddin/schemapack |
I've spent the last day or so exploring schemapack and integrating it into my project. It's a terrific library, and it's working well. I just wanted to say thanks Jared-Sprague for the recommendation, this will save us a lot of bandwidth. |
For future reference, since version 2.0.0 you can now provide your own parser: Please take a look at: |
The following code results in a mysterious third frame:
451-["clientMsg",{"_placeholder":true,"num":0}]
Cient
Server
Client
The above code is resulting in THREE frames I would expect only TWO frames, one from the client to the server and one from the server to the client. Can anyone explain what this third frame is, and how to get rid of it? See the blow screenshot:
The text was updated successfully, but these errors were encountered: