@Internal public class NettyRxWebSocketSession extends 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(String id,
io.netty.channel.Channel channel,
HttpRequest<?> request,
MediaTypeCodecRegistry codecRegistry,
String protocolVersion,
boolean isSecure)
Creates a new netty web socket session.
|
| Modifier and Type | Method and Description |
|---|---|
MutableConvertibleValues<Object> |
clear()
Clear all values.
|
void |
close() |
void |
close(CloseReason closeReason)
Close the session with the given event.
|
<T> Optional<T> |
get(CharSequence name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.
|
MutableConvertibleValues<Object> |
getAttributes() |
String |
getId()
The ID of the session.
|
Set<? extends RxWebSocketSession> |
getOpenSessions()
The current open sessions.
|
String |
getProtocolVersion()
The protocol version of the WebSocket protocol currently being used.
|
ConvertibleMultiValues<String> |
getRequestParameters()
The request parameters used to create this session.
|
URI |
getRequestURI()
The request URI this session was opened under.
|
boolean |
isOpen()
Whether the session is open.
|
boolean |
isSecure()
Whether the connection is secure.
|
Set<String> |
names() |
MutableConvertibleValues<Object> |
put(CharSequence key,
Object value)
Insert a value for the given key and value.
|
MutableConvertibleValues<Object> |
remove(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> CompletableFuture<T> |
sendAsync(T message,
MediaType mediaType)
Send the given message to the remote peer asynchronously.
|
void |
sendSync(Object message,
MediaType mediaType)
Send the given message to the remote peer synchronously.
|
String |
toString() |
Collection<Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSubprotocol, getUriVariables, getUserPrincipal, send, sendAsync, sendSyncof, putAll, putAllasMap, asMap, asProperties, contains, empty, forEach, getValueType, isEmpty, iterator, subMap, subMap, subMapget, get, getforEach, spliteratorpublic static final io.netty.util.AttributeKey<NettyRxWebSocketSession> WEB_SOCKET_SESSION_KEY
protected NettyRxWebSocketSession(String id, io.netty.channel.Channel channel, HttpRequest<?> request, MediaTypeCodecRegistry codecRegistry, 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 String getId()
WebSocketSessiongetId in interface WebSocketSessionpublic MutableConvertibleValues<Object> getAttributes()
getAttributes in interface WebSocketSessionpublic boolean isOpen()
WebSocketSessionisOpen in interface WebSocketSessionpublic boolean isSecure()
WebSocketSessionisSecure in interface WebSocketSessionpublic Set<? extends RxWebSocketSession> getOpenSessions()
RxWebSocketSessiongetOpenSessions in interface RxWebSocketSessiongetOpenSessions in interface WebSocketSessionWebSocketSession.getOpenSessions()public URI getRequestURI()
WebSocketSessiongetRequestURI in interface WebSocketSessionpublic ConvertibleMultiValues<String> getRequestParameters()
WebSocketSessiongetRequestParameters in interface WebSocketSessionpublic String getProtocolVersion()
WebSocketSessiongetProtocolVersion in interface WebSocketSessionpublic <T> 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.Publisher that either emits an error or emits the message once it has been published successfully.public void sendSync(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 AutoCloseablepublic void close(CloseReason closeReason)
WebSocketSessionclose in interface WebSocketSessioncloseReason - The close eventpublic MutableConvertibleValues<Object> put(CharSequence key, @Nullable Object value)
MutableConvertibleValuesput in interface MutableConvertibleValues<Object>key - The keyvalue - The valuepublic MutableConvertibleValues<Object> remove(CharSequence key)
MutableConvertibleValuesremove in interface MutableConvertibleValues<Object>key - The keypublic MutableConvertibleValues<Object> clear()
MutableConvertibleValuesclear in interface MutableConvertibleValues<Object>public Set<String> names()
names in interface ConvertibleValues<Object>public Collection<Object> values()
values in interface ConvertibleValues<Object>public <T> Optional<T> get(CharSequence name, ArgumentConversionContext<T> conversionContext)
ValueResolverget in interface ValueResolver<CharSequence>T - The concrete typename - The nameconversionContext - The conversion context