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
Not able to send message specific to user using STOMP over WebSocket [SPR-12444] #17049
Comments
Shailesh Vaishampayan commented Hi Brian, Thanks, |
Shailesh Vaishampayan commented Another thing I found out : in 4.0.8 above line I mentioned in org.springframework.messaging.simp.user.DefaultUserDestinationResolver looks like instead of Ofcourse you guys know better. seems to have been committed in 4.1.0 |
Brian Clozel commented Hi ShaileshV If you could come up with a minimal repro project, that'd be great. |
Shailesh Vaishampayan commented I guess yes. I couldn't revert to older version (4.0.8). However what i did is
I will try to create a minimal project. However above code change definitely proved that it was working with 4.0.8. Actually can't revert to 4.0.8 as because of some additional classes added in 4.1.1 and it starts breaking. |
Brian Clozel commented Hi ShaileshV - don't bother submitting a repro project. Thanks! |
Shailesh Vaishampayan commented Thanks Brian. Waiting for the next release with fix!! |
Brian Clozel commented ShaileshV The fix is in master, you should be able to test it in your application in a few minutes:
|
Shailesh Vaishampayan commented Sure Brian I will test this and update this. Am I supposed to Close this issue once I verify the fix? Just asking as using JIRA for first time. Thanks, |
Brian Clozel commented You don't have to close the issue, we'll do it when the fix ships with the next release. Good luck with your exams! |
Shailesh Vaishampayan commented Alright Brian. Thanks for the wishes!! |
bbwang commented in which way you finally resolved this issue,can i share your experience,i am a man Living i China,and i have exhausted in spring stomp websocket.thanks in advance. |
Shailesh Vaishampayan opened SPR-12444 and commented
Hi,
I am trying to create a chat app using spring websocket and stomp.
In this user can send message to each of his/her friends, who are also logged in, by logging into the app.
For sending message to particular user I take following steps:
/user/{user_id}/queue/messaging where user_id is recipient's user id.
I am trying to send this from client using STOMP.js send method.
Please find my example scenario :
User John logs in .
He subscribes to /user/queue/messaging
His user id is john
His session id is ABCD01
Queue is created with name on activemq broker as
messaging- userABCD01
User Alice logs in .
She subscribes to /user/queue/messaging
His user id is alice
Her session id is XYZ01
Queue is created with name on activemq broker as
messaging- userXYZ01
user John sends a message through STOMP.js send method to Alice
using destination as "/user/alice/queue/messaging"
now instead of delivering the message to queue
messaging- UserXYZ01 it gets delivered to John's queue destination i.e
messaging- userABCD01. Why is it so?
When i debugged this , I found following line in method
private DestinationInfo parseUserDestination(Message<?> message) of DefaultUserDestinationResolver class :
if (SimpMessageType.MESSAGE.equals(messageType)) {
........
sessionIds = (sessionId != null ?
Collections.singleton(sessionId) : this.userSessionRegistry.getSessionIds(user));
}
in this sessionId is logged in user's (Principal) sessoin id which is not null as user is logged in and so his sessionIds is returned. and message is delivered to his queue even if intended recipient user is different. when I check usersessionregistry's sessionIds collection i find an entry [alice]:XYZ01. Shouldn't above line return session id of the recipient user instead of logged in user's session id to identify destination queue.?
Sorry I am trying this for the first time. So Please let me know if I miss anything here and of there is
Thanks in advance.
Affects: 4.1.1
Reference URL: http://stackoverflow.com/questions/26967034/not-able-to-send-message-specific-to-user-using-spring-websocket-stomp
Issue Links:
@SendToUser
should provide a single session reply modeReferenced from: commits 75c70fa
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: