spring-projects/spring-framework — pull request #444 by devashishmamgain (2014-01-18 07:54:26+00:00)
Title: Fix same destination added to the different sessions of the same user causing duplicate messages

Fix same destination added to the different sessions of the same user

Prior to this commit, DefaultUserDestinationResolver uses the user to
get all the sessionIds and then adds all the target destinations of all
the sessions of the same user. In case of SUBSCRIBE message type, it
is already associated to a particular sessionId so there is no need to
get all the sessionIds for the same user. Problem due to this was
found in websocket where duplicate messages were coming.
Use case:
1. Open web page connect to the websocket connection.
2. Open the same page in another tab.

Spring messaging creates 2 different sessions for different tabs which
are linked to the same user.
Bug was while sending a websocket message to the user, the first tab
gets the message one time but the second tab gets the same message 2
times. And if we open more tabs, it keeps on increasing, the 3rd tabs
gets the same message 3 times, 4th tab 4 times and so on.

The current changes now directly uses the sessionId if the message type
is SUBSCRIBE or UNSUBSCRIBE.

Issue: SPR-11325