public interface WebSocketSession
Use session.receive()
to compose on
the inbound message stream, and session.send(publisher)
to provide the outbound message stream.
Modifier and Type | Method and Description |
---|---|
WebSocketMessage |
binaryMessage(java.util.function.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<java.lang.Void> |
close()
Close the WebSocket session with
CloseStatus.NORMAL . |
reactor.core.publisher.Mono<java.lang.Void> |
close(CloseStatus status)
Close the WebSocket session with the given status.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Return the map with attributes associated with the WebSocket session.
|
HandshakeInfo |
getHandshakeInfo()
Return information from the handshake request.
|
java.lang.String |
getId()
Return the id for the session.
|
WebSocketMessage |
pingMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a ping WebSocketMessage using the
bufferFactory() for the session. |
WebSocketMessage |
pongMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a pong WebSocketMessage using the
bufferFactory() for the session. |
reactor.core.publisher.Flux<WebSocketMessage> |
receive()
Provides access to the stream of inbound messages.
|
reactor.core.publisher.Mono<java.lang.Void> |
send(org.reactivestreams.Publisher<WebSocketMessage> messages)
Give a source of outgoing messages, write the messages and return a
Mono<Void> that completes when the source completes and writing
is done. |
WebSocketMessage |
textMessage(java.lang.String payload)
Factory method to create a text
WebSocketMessage using the
bufferFactory() for the session. |
java.lang.String getId()
HandshakeInfo getHandshakeInfo()
DataBufferFactory bufferFactory()
DataBuffer
Factory to create message payloads.java.util.Map<java.lang.String,java.lang.Object> getAttributes()
null
)reactor.core.publisher.Flux<WebSocketMessage> receive()
This stream receives a completion or error signal when the connection
is closed. In a typical WebSocketHandler
implementation this
stream is composed into the overall processing flow, so that when the
connection is closed, handling will end.
See the class-level doc of WebSocketHandler
and the reference
for more details and examples of how to handle the session.
reactor.core.publisher.Mono<java.lang.Void> send(org.reactivestreams.Publisher<WebSocketMessage> messages)
Mono<Void>
that completes when the source completes and writing
is done.
See the class-level doc of WebSocketHandler
and the reference
for more details and examples of how to handle the session.
default reactor.core.publisher.Mono<java.lang.Void> close()
CloseStatus.NORMAL
.reactor.core.publisher.Mono<java.lang.Void> close(CloseStatus status)
status
- the close statusWebSocketMessage textMessage(java.lang.String payload)
WebSocketMessage
using the
bufferFactory()
for the session.WebSocketMessage binaryMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.WebSocketMessage pingMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.WebSocketMessage pongMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
bufferFactory()
for the session.