@Internal public class NettyRxWebSocketSession extends java.lang.Object implements RxWebSocketSession
RxWebSocketSession interface for Netty and RxJava.| Modifier and Type | Field and Description |
|---|---|
static io.netty.util.AttributeKey<NettyRxWebSocketSession> |
WEB_SOCKET_SESSION_KEY
The WebSocket session is stored within a Channel attribute using the given key.
|
EMPTY| Modifier | Constructor and Description |
|---|---|
protected |
NettyRxWebSocketSession(java.lang.String id,
io.netty.channel.Channel channel,
HttpRequest<?> request,
MediaTypeCodecRegistry codecRegistry,
java.lang.String protocolVersion,
boolean isSecure)
Creates a new netty web socket session.
|
| Modifier and Type | Method and Description |
|---|---|
MutableConvertibleValues<java.lang.Object> |
clear()
Clear all values.
|
void |
close() |
void |
close(CloseReason closeReason)
Close the session with the given event.
|
<T> java.util.Optional<T> |
get(java.lang.CharSequence name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.
|
MutableConvertibleValues<java.lang.Object> |
getAttributes() |
java.lang.String |
getId()
The ID of the session.
|
java.util.Set<? extends RxWebSocketSession> |
getOpenSessions()
The current open sessions.
|
java.lang.String |
getProtocolVersion()
The protocol version of the WebSocket protocol currently being used.
|
ConvertibleMultiValues<java.lang.String> |
getRequestParameters()
The request parameters used to create this session.
|
java.net.URI |
getRequestURI()
The request URI this session was opened under.
|
boolean |
isOpen()
Whether the session is open.
|
boolean |
isSecure()
Whether the connection is secure.
|
boolean |
isWritable()
Whether the session is writable.
|
java.util.Set<java.lang.String> |
names() |
MutableConvertibleValues<java.lang.Object> |
put(java.lang.CharSequence key,
java.lang.Object value)
Insert a value for the given key and value.
|
MutableConvertibleValues<java.lang.Object> |
remove(java.lang.CharSequence key)
Remove a value for the given key.
|
<T> io.reactivex.Flowable<T> |
send(T message,
MediaType mediaType)
Broadcast a message and return a
Flowable. |
<T> java.util.concurrent.CompletableFuture<T> |
sendAsync(T message,
MediaType mediaType)
Send the given message to the remote peer asynchronously.
|
void |
sendSync(java.lang.Object message,
MediaType mediaType)
Send the given message to the remote peer synchronously.
|
java.lang.String |
toString() |
java.util.Collection<java.lang.Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSubprotocol, getUriVariables, getUserPrincipal, send, sendAsync, sendSyncof, putAll, putAllasMap, asMap, asProperties, contains, empty, forEach, getValue, getValueType, isEmpty, iterator, subMap, subMap, subMapget, get, getpublic static final io.netty.util.AttributeKey<NettyRxWebSocketSession> WEB_SOCKET_SESSION_KEY
protected NettyRxWebSocketSession(java.lang.String id,
io.netty.channel.Channel channel,
HttpRequest<?> request,
MediaTypeCodecRegistry codecRegistry,
java.lang.String protocolVersion,
boolean isSecure)
id - The IDchannel - The channelrequest - The original request used to create the sessioncodecRegistry - The codec registryprotocolVersion - The protocol versionisSecure - Whether the session is securepublic java.lang.String getId()
WebSocketSessiongetId in interface WebSocketSessionpublic MutableConvertibleValues<java.lang.Object> getAttributes()
getAttributes in interface WebSocketSessionpublic boolean isOpen()
WebSocketSessionisOpen in interface WebSocketSessionpublic boolean isWritable()
WebSocketSessionisWritable in interface WebSocketSessionpublic boolean isSecure()
WebSocketSessionisSecure in interface WebSocketSessionpublic java.util.Set<? extends RxWebSocketSession> getOpenSessions()
RxWebSocketSessiongetOpenSessions in interface RxWebSocketSessiongetOpenSessions in interface WebSocketSessionWebSocketSession.getOpenSessions()public java.net.URI getRequestURI()
WebSocketSessiongetRequestURI in interface WebSocketSessionpublic ConvertibleMultiValues<java.lang.String> getRequestParameters()
WebSocketSessiongetRequestParameters in interface WebSocketSessionpublic java.lang.String getProtocolVersion()
WebSocketSessiongetProtocolVersion in interface WebSocketSessionpublic <T> java.util.concurrent.CompletableFuture<T> sendAsync(T message,
MediaType mediaType)
WebSocketSessionsendAsync in interface WebSocketSessionT - The message typemessage - The messagemediaType - The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry.CompletableFuture that tracks the execution. CompletableFuture.get() and related methods will return the message on success, on error throw the underlying Exception.public void sendSync(java.lang.Object message,
MediaType mediaType)
WebSocketSessionsendSync in interface WebSocketSessionmessage - The messagemediaType - The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry.public <T> io.reactivex.Flowable<T> send(T message,
MediaType mediaType)
RxWebSocketSessionFlowable.send in interface RxWebSocketSessionsend in interface WebSocketSessionT - The message generic typemessage - The messagemediaType - The media typeFlowablepublic void close()
close in interface WebSocketSessionclose in interface java.lang.AutoCloseablepublic void close(CloseReason closeReason)
WebSocketSessionclose in interface WebSocketSessioncloseReason - The close eventpublic java.lang.String toString()
toString in class java.lang.Objectpublic MutableConvertibleValues<java.lang.Object> put(java.lang.CharSequence key, @Nullable java.lang.Object value)
MutableConvertibleValuesput in interface MutableConvertibleValues<java.lang.Object>key - The keyvalue - The valuepublic MutableConvertibleValues<java.lang.Object> remove(java.lang.CharSequence key)
MutableConvertibleValuesremove in interface MutableConvertibleValues<java.lang.Object>key - The keypublic MutableConvertibleValues<java.lang.Object> clear()
MutableConvertibleValuesclear in interface MutableConvertibleValues<java.lang.Object>public java.util.Set<java.lang.String> names()
names in interface ConvertibleValues<java.lang.Object>public java.util.Collection<java.lang.Object> values()
values in interface ConvertibleValues<java.lang.Object>public <T> java.util.Optional<T> get(java.lang.CharSequence name,
ArgumentConversionContext<T> conversionContext)
ValueResolverget in interface ValueResolver<java.lang.CharSequence>T - The concrete typename - The nameconversionContext - The conversion context