WebSession to WebSocketSession attribute passing

This commit makes it possible to pass attributes from the WebSession of
a handshake request to the WebSocketSession, by configuring a
Predicate<String> on HandshakeWebSocketService.

Issue: SPR-16212
This commit is contained in:
Rossen Stoyanchev
2018-05-18 21:30:13 -04:00
parent 9074828478
commit 192c7a5627
12 changed files with 261 additions and 64 deletions

View File

@@ -202,7 +202,10 @@ of `HandshakeWebSocketService`, which performs basic checks on the WebSocket req
then uses `RequestUpgradeStrategy` for the server in use. Currently there is built-in
support for Reactor Netty, Tomcat, Jetty, and Undertow.
The above are just 3 examples to serve as a starting point.
`HandshakeWebSocketService` exposes a `sessionAttributePredicate` property that allows
setting a `Predicate<String>` to extract attributes from the `WebSession` and insert them
into the attributes of the `WebSocketSession`.
@@ -210,7 +213,7 @@ The above are just 3 examples to serve as a starting point.
=== Server config
[.small]#<<web.adoc#websocket-server-runtime-configuration,Same in Servlet stack>>#
The `RequestUpgradeStrategy` for each server exposes the WebSocket-related configuration
The `RequestUpgradeStrategy` for each server exposes WebSocket-related configuration
options available for the underlying WebSocket engine. Below is an example of setting
WebSocket options when running on Tomcat: