|
|
@ -1818,12 +1818,16 @@ its own implementation of `WebSocketMessageBrokerConfigurer` that is marked with |
|
|
|
An application can send messages that target a specific user, and Spring's STOMP support |
|
|
|
An application can send messages that target a specific user, and Spring's STOMP support |
|
|
|
recognizes destinations prefixed with `/user/` for this purpose. |
|
|
|
recognizes destinations prefixed with `/user/` for this purpose. |
|
|
|
For example, a client might subscribe to the `/user/queue/position-updates` destination. |
|
|
|
For example, a client might subscribe to the `/user/queue/position-updates` destination. |
|
|
|
This destination is handled by the `UserDestinationMessageHandler` and |
|
|
|
`UserDestinationMessageHandler` handles this destination and transforms it into a |
|
|
|
transformed into a destination unique to the user session |
|
|
|
destination unique to the user session (such as `/queue/position-updates-user123`). |
|
|
|
(such as `/queue/position-updates-user123`). This provides the convenience of subscribing |
|
|
|
This provides the convenience of subscribing to a generically named destination while, |
|
|
|
to a generically named destination while, at the same time, ensuring no collisions |
|
|
|
at the same time, ensuring no collisions with other users who subscribe to the same |
|
|
|
with other users who subscribe to the same destination so that each user can receive |
|
|
|
destination so that each user can receive unique stock position updates. |
|
|
|
unique stock position updates. |
|
|
|
|
|
|
|
|
|
|
|
TIP: When working with user destinations, it is important to configure broker and |
|
|
|
|
|
|
|
application destination prefixes as shown in <<websocket-stomp-enable>>, or otherwise the |
|
|
|
|
|
|
|
broker would handle "/user" prefixed messages that should only be handled by |
|
|
|
|
|
|
|
`UserDestinationMessageHandler`. |
|
|
|
|
|
|
|
|
|
|
|
On the sending side, messages can be sent to a destination such as |
|
|
|
On the sending side, messages can be sent to a destination such as |
|
|
|
pass:q[`/user/{username}/queue/position-updates`], which in turn is translated |
|
|
|
pass:q[`/user/{username}/queue/position-updates`], which in turn is translated |
|
|
|