public abstract class AbstractWebSocketSession<T> extends Object implements WebSocketSession
WebSocketSession implementations that
holds common fields and exposes accessors. Also implements the
WebSocketMessage factory methods.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWebSocketSession(T delegate,
String id,
HandshakeInfo handshakeInfo,
DataBufferFactory bufferFactory)
Create a new instance and associate the given attributes with it.
|
| Modifier and Type | Method and Description |
|---|---|
WebSocketMessage |
binaryMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a binary WebSocketMessage using the
WebSocketSession.bufferFactory() for the session. |
DataBufferFactory |
bufferFactory()
Return a
DataBuffer Factory to create message payloads. |
protected T |
getDelegate() |
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
WebSocketSession.bufferFactory() for the session. |
WebSocketMessage |
pongMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
Factory method to create a pong WebSocketMessage using the
WebSocketSession.bufferFactory() for the session. |
abstract reactor.core.publisher.Flux<WebSocketMessage> |
receive()
Get the flux of incoming messages.
|
abstract 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
WebSocketSession.bufferFactory() for the session. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, closeprotected AbstractWebSocketSession(T delegate, String id, HandshakeInfo handshakeInfo, DataBufferFactory bufferFactory)
protected T getDelegate()
public String getId()
WebSocketSessiongetId in interface WebSocketSessionpublic HandshakeInfo getHandshakeInfo()
WebSocketSessiongetHandshakeInfo in interface WebSocketSessionpublic DataBufferFactory bufferFactory()
WebSocketSessionDataBuffer Factory to create message payloads.bufferFactory in interface WebSocketSessionpublic abstract reactor.core.publisher.Flux<WebSocketMessage> receive()
WebSocketSessionreceive in interface WebSocketSessionpublic abstract reactor.core.publisher.Mono<Void> send(org.reactivestreams.Publisher<WebSocketMessage> messages)
WebSocketSessionsend in interface WebSocketSessionmessages - the messages to writepublic WebSocketMessage textMessage(String payload)
WebSocketSessionWebSocketMessage using the
WebSocketSession.bufferFactory() for the session.textMessage in interface WebSocketSessionpublic WebSocketMessage binaryMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSessionWebSocketSession.bufferFactory() for the session.binaryMessage in interface WebSocketSessionpublic WebSocketMessage pingMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSessionWebSocketSession.bufferFactory() for the session.pingMessage in interface WebSocketSessionpublic WebSocketMessage pongMessage(Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSessionWebSocketSession.bufferFactory() for the session.pongMessage in interface WebSocketSession