Skip to content

Commit a3655c4

Browse files
committed
Add tip related to user destinations in STOMP
See gh-26986
1 parent 3f66ef7 commit a3655c4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/docs/asciidoc/web/websocket.adoc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,12 +1818,16 @@ its own implementation of `WebSocketMessageBrokerConfigurer` that is marked with
18181818
An application can send messages that target a specific user, and Spring's STOMP support
18191819
recognizes destinations prefixed with `/user/` for this purpose.
18201820
For example, a client might subscribe to the `/user/queue/position-updates` destination.
1821-
This destination is handled by the `UserDestinationMessageHandler` and
1822-
transformed into a destination unique to the user session
1823-
(such as `/queue/position-updates-user123`). This provides the convenience of subscribing
1824-
to a generically named destination while, at the same time, ensuring no collisions
1825-
with other users who subscribe to the same destination so that each user can receive
1826-
unique stock position updates.
1821+
`UserDestinationMessageHandler` handles this destination and transforms it into a
1822+
destination unique to the user session (such as `/queue/position-updates-user123`).
1823+
This provides the convenience of subscribing to a generically named destination while,
1824+
at the same time, ensuring no collisions with other users who subscribe to the same
1825+
destination so that each user can receive unique stock position updates.
1826+
1827+
TIP: When working with user destinations, it is important to configure broker and
1828+
application destination prefixes as shown in <<websocket-stomp-enable>>, or otherwise the
1829+
broker would handle "/user" prefixed messages that should only be handled by
1830+
`UserDestinationMessageHandler`.
18271831

18281832
On the sending side, messages can be sent to a destination such as
18291833
pass:q[`/user/{username}/queue/position-updates`], which in turn is translated

0 commit comments

Comments
 (0)