-
Notifications
You must be signed in to change notification settings - Fork 44
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
Question: is there any way to detect the used engine.io version? #35
Comments
A future proof solution would be if the handshake data would contain an additional version field. If it's missing than it's most probably a server using v3 otherwise its value is the version that i (and maybe other too) could use. |
You should be able to detect the version of the Engine.IO server based on the format of the handshake packet:
Details: |
Thanks, that could work. Any advice for a websocket only session? |
AFAIK it's the same for v3 and v4. These are received from different versions:
The documentation also looks like the same (i couldn't find any differences at least) for v3 and v4: |
Arf, you are right. For a WebSocket-only session, I think the only difference is the encoding of a binary packet. The packet is prefixed with "4" in v3, whereas it is sent as is in v4. |
Yep, but that's hard to use to decide whether it's v3 or v4, because "4" can be part of the binary data too. |
@darrachequesne Any chance to include something in the handshake payload that would indicate the version of the protocol? |
We could check the value of the |
Hey, sorry for the late reply! My only real objection is that it would add additional round-trips, but otherwise it seems good. |
In order to ease the migration to Socket.IO v3, the Engine.IO server can now communicate with v3.x clients. ```js const eioServer = require("engine.io")(httpServer, { allowEIO3: true // false by default }); ``` If `allowEIO3` is false, the v3.x clients will now receive an HTTP 400 response ("Unsupported protocol version"). Note: the code of the v3 parser has been imported from [1] and browser-related dependencies were removed. [1]: https://github.com/socketio/engine.io-parser/tree/2.2.1 Related: - socketio/engine.io-protocol#35 - socketio/socket.io-protocol#21
The server now supports v3 and v4 clients: socketio/engine.io@663d326 (included in |
I have a c# implementation that should work with both v3 and v4. Because v4 has a few breaking changes, i can't implement them in a backward compatible way and different code must be executed based on the version of the server.
The text was updated successfully, but these errors were encountered: