-
Notifications
You must be signed in to change notification settings - Fork 72
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
Duplicate response messages sent when multiple browser tabs/windows are open #4
Comments
For me it looks like ProxyWebSocketConnectionManager making subscription per raw destination is the issue. For example: /org/springframework/messaging/simp/user/UserDestinationMessageHandler.java might be the hint @mthizo247 What do you think? |
I got the same problem, I tried to send a topic message, the message would be received twice when there was two tabs. |
Do you have solved it?@tkec |
I have solved it |
@minlingchao1 Could you share your solution, please? |
@endario it's hard to solve that , and my solution is let it go , but we need change the project code behind the zuul project, modifying convertAndSend to convertAndSendToUser + loop, or you can say modifying topic to queue + loop , like bellow:
while tokens contains all the sessions user alive, and then change the method : to:
|
as in my project , we authenticate users by token, so principal is not available, so , i conbined toUserId with the payload, and then convertAndSendToUser ... |
I'm using this to send messages to users that may have multiple tabs/windows open. I noticed in this case duplicate messages are sent from the proxy. I can also reproduce this with the demo, https://github.com/mthizo247/zuul-websocket-support-demo.
When using the demo, start the proxy and hello app. Open two tabs or windows going through the proxy, http://localhost:7078/, and click connect on both. Enter your name in the "What's your name?" input box, then click send. Observe in the console that two "MESSAGE" responses are received in both. If you have three tabs or windows open, then three "MESSAGE" responses are sent to each.
If you do the same thing going directly to the hello app, http://localhost:7079/, you don't get the duplicate messages.
The text was updated successfully, but these errors were encountered: