Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Add namespace feature SocketIOConnection. #19

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ghqian
Copy link

@ghqian ghqian commented Feb 2, 2022

Reason:
When you use url like http://localhost:3000/ the socket.io client will create a websocket transport url like ws://localhost:3000/socket.io.
It will work fine.
But when you have url like http://localhost:3000/march, then the websocket transport url is also ws://localhost:3000/socket.io but with namespace "/march".
And onConnection event in client may need connect signal for namespace "/" and also "/march".
After then the emit from server can use namespace "/march" in its packets, and the client will react to namespace "/march" emit.

Reason:
When you use url like http://localhost:3000/ the socket.io client will create a websocket transport url like ws://localhost:3000/socket.io.
It will work fine.
But when you have url like http://localhost:3000/march, then the websocket transport url is also ws://localhost:3000/socket.io but with namespace "/march".
And onConnection event in client may need connect signal for namespace "/" and also "/march".
After then the emit from server can use namespace "/march" in its packets, and the client will react to namespace "/march" emit.
@ghqian ghqian mentioned this pull request Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants