Affects: 5.3.13 Spring Websockets
Issue: trying to send direct message to user established websockets session on another host of cluster does not send the message to this user websocket sessions on different host, only on the current one. Works only if we identify user NOT by session id
Reproduce steps:
Run two copies of app in a cluster. Setup broker relay (like activemq). Establish websocket session for user1 on server1. Some client app also should subscribe to the topic "/user/topic/sometopic" to server1 as user1. From server2 send message to user1 as convertAndSendToUser("user1", "/topic/sometopic"). Message is not received by the subscribed client. Try to connect client to server1 and repeat - message will be received. Works only when we are sending message not to session id as a user, but to some principal name like user1
Hint: Seems like the issue could be in the architecture - topics on broker receive the name like /topic/sometopic-user321321 and Spring Websockets use internal mapping registry to determine to what topics to send messages. But as registry is not distributed, Spring Websockets is not aware of the session ids for this user on another host.
Comment From: livk-cloud
I think you can use MQ to send broadcast messages and transmit user IDs. After each service is monitored, you can judge whether it belongs to the session ID stored on your own.
Comment From: rstoyanchev
Have you configured the userDestinationBroadcast
property of MessageBrokerRegistry
as mentioned at the end of the User Destinations section of the docs?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: vitali-kviatkouski
Have you configured the
userDestinationBroadcast
property ofMessageBrokerRegistry
as mentioned at the end of the User Destinations section of the docs?
Thanks, that helps, closing issue