-
Notifications
You must be signed in to change notification settings - Fork 982
Update README.md #716
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
Update README.md #716
Conversation
Hi, I am not sure where the repo is to edit/update the documentation here: https://socketio.github.io/socket.io-client-java/initialization.html Could you please add a section around multiplexing. I have spent hours debugging an issue on our end where we did not init the sockets correctly for multiplexing. Could save other developers a lot of time. Here are the details. ### Multiplexing When using multiplexing please ensure you create your namespaces as follow Set the options ``` IO.Options options = IO.Options.builder() .setMultiplex(true) ``` Incorrect way: ``` Socket socket = IO.socket(URI.create("https://example.com"), options); // the main namespace Socket productSocket = IO.socket(URI.create("https://example.com/product"), options); // the "product" namespace socket.connect(); productSocket.connect(); ``` The first connect() will succeed to `/` and `/product`. The 2nd attempt will not set the `socket.client.user` object correctly. See screenshots below of attempt socketio#1 and attempt socketio#2 using the incorrect configuration as shown above. Correct way: ``` Socket socket = IO.socket(URI.create("https://example.com"), options); // the main namespace Socket productSocket = socket.io().socket("/product"); // the "product" namespace socket.connect(); productSocket.connect(); ``` This will reconnect correct every time, even if you reinit and reconnect the socket multiple times.
Hi! That's weird, your first example should work properly: Socket socket = IO.socket(URI.create("https://example.com"), options); // the main namespace
Socket productSocket = IO.socket(URI.create("https://example.com/product"), options); // the "product" namespace
socket.connect();
productSocket.connect();
System.out.println(socket.io() == productSocket.io()); // true Regarding the |
Hi there, thanks for the response! On our server side we use
|
@sup-fmarais I'm afraid this won't be sufficient for me to be able to help you... Could you please provide a complete example? |
Sure I will try and set some time aside to do a client/server example matching our setup for you to test. |
I think this can be closed now. Please reopen if needed. |
Hi, I am not sure where the repo is to edit/update the documentation here: https://socketio.github.io/socket.io-client-java/initialization.html
Could you please add a section around multiplexing. I have spent hours debugging an issue on our end where we did not init the sockets correctly for multiplexing. Could save other developers a lot of time. Here are the details.
Multiplexing
When using multiplexing please ensure you create your namespaces as follow
Set the options
Incorrect way:
The first connect() will succeed to
/
and/product
.The 2nd attempt will not set the
socket.client.user
object correctly.See screenshots below of attempt #1 and attempt #2 using the incorrect configuration as shown above.
Correct way:
This will reconnect correct every time, even if you reinit and reconnect the socket multiple times.
Failure:

Success:
