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

io.protocol is undefined #5146

Open
Anand-Keshavan opened this issue Jul 25, 2024 · 1 comment
Open

io.protocol is undefined #5146

Anand-Keshavan opened this issue Jul 25, 2024 · 1 comment
Labels
question Further information is requested

Comments

@Anand-Keshavan
Copy link

Describe the bug
io.protocol is undefined

To Reproduce

Please fill the following code example:

Socket.IO server version: not relevant

Server

 

Socket.IO client version: 4.7.5

Client

 import { io } from "socket.io-client";
const revisionNumber = io.protocol;

console.log(`$$$Debug: SocketIo PROTOCOL NUMBER ${revisionNumber}`); --> undefined

Expected behavior
expected the socket protocol number.
As the python-socketio server returns "The client is using an unsupported version of the Socket.IO or Engine.IO protocols"
This is a monrepo with different components using different versions of the socket.io client library.
I need to figure out whether the library used by my component follows the correct protocol.
It is bad enough that there is no way to know the version of the library programmatically.

Platform:

  • Device: [e.g. Samsung S8]
  • OS: [e.g. Android 9.2]

Additional context
Add any other context about the problem here.

@Anand-Keshavan Anand-Keshavan added the to triage Waiting to be triaged by a member of the team label Jul 25, 2024
@darrachequesne
Copy link
Member

The syntax is:

import { protocol } from "socket.io-client";

console.log(protocol); // current is 5

Reference for the Socket.IO protocol: https://github.com/socketio/socket.io/blob/main/docs/socket.io-protocol/v5-current.md

Same with the underlying Engine.IO client:

import { protocol } from "engine.io-client";

console.log(protocol); // current is 4

Reference for the Engine.IO protocol: https://github.com/socketio/socket.io/blob/main/docs/engine.io-protocol/v4-current.md

@darrachequesne darrachequesne added question Further information is requested and removed to triage Waiting to be triaged by a member of the team labels Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants