Class ServletWebSocketSession

java.lang.Object
io.micronaut.servlet.websocket.ServletWebSocketSession
All Implemented Interfaces:
io.micronaut.core.convert.ConversionServiceProvider, io.micronaut.core.convert.value.ConvertibleValues<Object>, io.micronaut.core.convert.value.MutableConvertibleValues<Object>, io.micronaut.core.value.ValueResolver<CharSequence>, io.micronaut.websocket.WebSocketSession, AutoCloseable, Iterable<Map.Entry<String,Object>>

@Internal public final class ServletWebSocketSession extends Object implements io.micronaut.websocket.WebSocketSession
A WebSocketSession backed by a jakarta.websocket.Session.

All outbound writes go through a single queue with at most one send outstanding on the container. Jakarta containers reject a second asynchronous send while one is still in flight, whereas Micronaut application code and the broadcaster may send from any thread at any time.

Since:
6.2.0
Author:
graemerocher
  • Method Details

    • getNativeSession

      public jakarta.websocket.Session getNativeSession()
      Returns:
      The underlying Jakarta WebSocket session
    • getId

      public String getId()
      Specified by:
      getId in interface io.micronaut.websocket.WebSocketSession
    • getAttributes

      public io.micronaut.core.convert.value.MutableConvertibleValues<Object> getAttributes()
      Specified by:
      getAttributes in interface io.micronaut.websocket.WebSocketSession
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface io.micronaut.websocket.WebSocketSession
    • isWritable

      public boolean isWritable()
      Specified by:
      isWritable in interface io.micronaut.websocket.WebSocketSession
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface io.micronaut.websocket.WebSocketSession
    • getOpenSessions

      public Set<? extends io.micronaut.websocket.WebSocketSession> getOpenSessions()
      Specified by:
      getOpenSessions in interface io.micronaut.websocket.WebSocketSession
    • getRequestURI

      public URI getRequestURI()
      Specified by:
      getRequestURI in interface io.micronaut.websocket.WebSocketSession
    • getProtocolVersion

      public String getProtocolVersion()
      Specified by:
      getProtocolVersion in interface io.micronaut.websocket.WebSocketSession
    • getSubprotocol

      public Optional<String> getSubprotocol()
      Specified by:
      getSubprotocol in interface io.micronaut.websocket.WebSocketSession
    • getRequestParameters

      public io.micronaut.core.convert.value.ConvertibleMultiValues<String> getRequestParameters()
      Specified by:
      getRequestParameters in interface io.micronaut.websocket.WebSocketSession
    • getUriVariables

      public io.micronaut.core.convert.value.ConvertibleValues<Object> getUriVariables()
      Specified by:
      getUriVariables in interface io.micronaut.websocket.WebSocketSession
    • getUserPrincipal

      public Optional<Principal> getUserPrincipal()
      Specified by:
      getUserPrincipal in interface io.micronaut.websocket.WebSocketSession
    • send

      public <T> org.reactivestreams.Publisher<T> send(T message, io.micronaut.http.MediaType mediaType)
      Specified by:
      send in interface io.micronaut.websocket.WebSocketSession
    • sendAsync

      public <T> CompletableFuture<T> sendAsync(T message, io.micronaut.http.MediaType mediaType)
      Specified by:
      sendAsync in interface io.micronaut.websocket.WebSocketSession
    • sendPingAsync

      public CompletableFuture<?> sendPingAsync(byte[] content)
      Specified by:
      sendPingAsync in interface io.micronaut.websocket.WebSocketSession
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface io.micronaut.websocket.WebSocketSession
    • close

      public void close(io.micronaut.websocket.CloseReason closeReason)
      Specified by:
      close in interface io.micronaut.websocket.WebSocketSession
    • put

      public io.micronaut.core.convert.value.MutableConvertibleValues<Object> put(CharSequence key, @Nullable Object value)
      Specified by:
      put in interface io.micronaut.core.convert.value.MutableConvertibleValues<Object>
    • remove

      public io.micronaut.core.convert.value.MutableConvertibleValues<Object> remove(CharSequence key)
      Specified by:
      remove in interface io.micronaut.core.convert.value.MutableConvertibleValues<Object>
    • clear

      public io.micronaut.core.convert.value.MutableConvertibleValues<Object> clear()
      Specified by:
      clear in interface io.micronaut.core.convert.value.MutableConvertibleValues<Object>
    • names

      public Set<String> names()
      Specified by:
      names in interface io.micronaut.core.convert.value.ConvertibleValues<Object>
    • values

      public Collection<Object> values()
      Specified by:
      values in interface io.micronaut.core.convert.value.ConvertibleValues<Object>
    • get

      public <T> Optional<T> get(CharSequence name, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
      Specified by:
      get in interface io.micronaut.core.value.ValueResolver<CharSequence>
    • toString

      public String toString()
      Overrides:
      toString in class Object