Top Description Methods
org.springframework.web.reactive.socket.server

public Interface RequestUpgradeStrategy

Known Direct Implementers
org.springframework.web.reactive.socket.server.upgrade.JettyRequestUpgradeStrategy, org.springframework.web.reactive.socket.server.upgrade.ReactorNetty2RequestUpgradeStrategy, org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy, org.springframework.web.reactive.socket.server.upgrade.StandardWebSocketUpgradeStrategy, org.springframework.web.reactive.socket.server.upgrade.UndertowRequestUpgradeStrategy
Imports
java.util.function.Supplier, reactor.core.publisher.Mono, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.web.reactive.socket.HandshakeInfo, .WebSocketHandler, org.springframework.web.server.ServerWebExchange

A strategy for upgrading an HTTP request to a WebSocket session depending on the underlying network runtime.

Typically there is one such strategy for every ServerHttpRequest and ServerHttpResponse type except in the case of Servlet containers for which the standard Jakarta WebSocket API (JSR-356) does not define a way to upgrade a request so a custom strategy is needed for every Servlet container.

Author
Rossen Stoyanchev
Since
5.0
See Also
org.springframework.web.reactive.socket.server.upgrade.StandardWebSocketUpgradeStrategy

Method Summary

Modifier and TypeMethod and Description
public Mono<Void>

Returns:

completion Mono<Void> to indicate the outcome of the WebSocket session handling.
upgrade
(ServerWebExchange
the current exchange
exchange
,
WebSocketHandler
handler for the WebSocket session
webSocketHandler
,
String
the selected sub-protocol got the handler
subProtocol
,
Supplier<HandshakeInfo>
factory to create HandshakeInfo for the WebSocket session
handshakeInfoFactory
)

Upgrade to a WebSocket session and handle it with the given handler.

Method Detail

upgradeback to summary
public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)

Upgrade to a WebSocket session and handle it with the given handler.

Parameters
exchange:ServerWebExchange

the current exchange

webSocketHandler:WebSocketHandler

handler for the WebSocket session

subProtocol:String

the selected sub-protocol got the handler

handshakeInfoFactory:Supplier<HandshakeInfo>

factory to create HandshakeInfo for the WebSocket session

Returns:Mono<Void>

completion Mono<Void> to indicate the outcome of the WebSocket session handling.

Since
5.1