0

I customized the tutorial http://assets.spring.io/wp/WebSocketBlogPost.html into my application . When sending message from the application to the server using SimpMessageSendingOperations.convertAndSendToUser("fabrice","/stayawakews2/shakebaby", "mano") the log show :

/stayawakews2/shakebaby*-userltmei5cm* .I dont know why it add the value -userltmei5cm .

thanks

romu31
  • 821
  • 9
  • 17

2 Answers2

2

this is explained in the reference docs, see the section on user destinations and also these slides.

Rossen Stoyanchev
  • 4,910
  • 23
  • 26
  • thanks both , going to upgrade spring security with annotation first .thanks for the slides . – romu31 Jan 18 '14 at 16:39
  • It works now but the log messages could be confusing: Sending message to resolved destination=/queue/position-updates-usersr6chstw, I mean the usersr6chstw part since it is not the user name – romu31 Jan 22 '14 at 16:25
0

ltmei5cm - this is a websocket session id. This value generates on client side.

One logined user can have some websocket sessions. For each webscocket connection(session) spring create individual queue.

If you send message to specific user, message will be added to some queues. For this reason, the user name is replaced with the webcoket session id.

From JavaDoc comment to DefaultUserDestinationResolver.java:

When a user attempts to subscribe to "/user/queue/position-updates", the "/user" prefix is removed and a unique suffix added, resulting in something like "/queue/position-updates-useri9oqdfzo" where the suffix is based on the user's session and ensures it does not collide with any other users attempting to subscribe to "/user/queue/position-updates".

When a message is sent to a user with a destination such as "/user/{username}/queue/position-updates", the "/user/{username}" prefix is removed and the suffix added, resulting in something like "/queue/position-updates-useri9oqdfzo".