public abstract class AbstractWebSocketSession<T> extends java.lang.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,
java.lang.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(java.util.function.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.
|
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
WebSocketSession.bufferFactory() for the session. |
WebSocketMessage |
pongMessage(java.util.function.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 access to the stream of incoming messages.
|
abstract reactor.core.publisher.Mono<java.lang.Void> |
send(org.reactivestreams.Publisher<WebSocketMessage> messages)
Write the given messages to the WebSocket connection.
|
WebSocketMessage |
textMessage(java.lang.String payload)
Factory method to create a text
WebSocketMessage using the
WebSocketSession.bufferFactory() for the session. |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, close
protected AbstractWebSocketSession(T delegate, java.lang.String id, HandshakeInfo handshakeInfo, DataBufferFactory bufferFactory)
protected T getDelegate()
public java.lang.String getId()
WebSocketSession
getId
in interface WebSocketSession
public HandshakeInfo getHandshakeInfo()
WebSocketSession
getHandshakeInfo
in interface WebSocketSession
public DataBufferFactory bufferFactory()
WebSocketSession
DataBuffer
Factory to create message payloads.bufferFactory
in interface WebSocketSession
public abstract reactor.core.publisher.Flux<WebSocketMessage> receive()
WebSocketSession
receive
in interface WebSocketSession
public abstract reactor.core.publisher.Mono<java.lang.Void> send(org.reactivestreams.Publisher<WebSocketMessage> messages)
WebSocketSession
send
in interface WebSocketSession
messages
- the messages to writepublic WebSocketMessage textMessage(java.lang.String payload)
WebSocketSession
WebSocketMessage
using the
WebSocketSession.bufferFactory()
for the session.textMessage
in interface WebSocketSession
public WebSocketMessage binaryMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSession
WebSocketSession.bufferFactory()
for the session.binaryMessage
in interface WebSocketSession
public WebSocketMessage pingMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSession
WebSocketSession.bufferFactory()
for the session.pingMessage
in interface WebSocketSession
public WebSocketMessage pongMessage(java.util.function.Function<DataBufferFactory,DataBuffer> payloadFactory)
WebSocketSession
WebSocketSession.bufferFactory()
for the session.pongMessage
in interface WebSocketSession
public java.lang.String toString()
toString
in class java.lang.Object