public interface WebSocketSession
On the server side a WebSocket session can be handled by mapping
requests to a WebSocketHandler
and ensuring there is a
WebSocketHandlerAdapter
strategy registered in Spring configuration.
On the client side a WebSocketHandler
can be provided to a
WebSocketClient
.
Modifier and Type | Method and Description |
---|---|
WebSocketMessage |
binaryMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a binary WebSocketMessage using the
bufferFactory() for the session. |
DataBufferFactory |
bufferFactory()
Return a
DataBuffer Factory to create message payloads. |
default reactor.core.publisher.Mono<Void> |
close()
Close the WebSocket session with
CloseStatus.NORMAL . |
reactor.core.publisher.Mono<Void> |
close(CloseStatus status)
Close the WebSocket session with the given status.
|
HandshakeInfo |
getHandshakeInfo()
Return information from the handshake request.
|
String |
getId()
Return the id for the session.
|
WebSocketMessage |
pingMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a ping WebSocketMessage using the
bufferFactory() for the session. |
WebSocketMessage |
pongMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a pong WebSocketMessage using the
bufferFactory() for the session. |
reactor.core.publisher.Flux<WebSocketMessage> |
receive()
Get the flux of incoming messages.
|
reactor.core.publisher.Mono<Void> |
send(org.reactivestreams.Publisher<WebSocketMessage> messages)
Write the given messages to the WebSocket connection.
|
WebSocketMessage |
textMessage(String payload)
Factory method to create a text
WebSocketMessage using the
bufferFactory() for the session. |
String getId()
HandshakeInfo getHandshakeInfo()
DataBufferFactory bufferFactory()
DataBuffer
Factory to create message payloads.reactor.core.publisher.Flux<WebSocketMessage> receive()
reactor.core.publisher.Mono<Void> send(org.reactivestreams.Publisher<WebSocketMessage> messages)
messages
- the messages to writedefault reactor.core.publisher.Mono<Void> close()
CloseStatus.NORMAL
.reactor.core.publisher.Mono<Void> close(CloseStatus status)
status
- the close statusWebSocketMessage textMessage(String payload)
WebSocketMessage
using the
bufferFactory()
for the session.WebSocketMessage binaryMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.WebSocketMessage pingMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.WebSocketMessage pongMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.