Class JettywebSocketSession

java.lang.Object
org.springframework.web.reactive.socket.adapter.AbstractwebSocketSession<org.eclipse.jetty.websocket.api.Session>
org.springframework.web.reactive.socket.adapter.JettywebSocketSession
All Implemented Interfaces:
webSocketSession

public class JettywebSocketSession extends AbstractwebSocketSession<org.eclipse.jetty.websocket.api.Session>
Spring webSocketSession implementation that adapts to a Jetty webSocket Session.
Since:
5.0
Author:
Violeta Georgieva, Rossen Stoyanchev
  • Constructor Details

    • JettywebSocketSession

      public JettywebSocketSession(org.eclipse.jetty.websocket.api.Session session, HandshakeInfo info, DataBufferFactory factory)
    • JettywebSocketSession

      public JettywebSocketSession(org.eclipse.jetty.websocket.api.Session session, HandshakeInfo info, DataBufferFactory factory, @Nullable reactor.core.publisher.Sinks.Empty<Void> completionSink)
  • Method Details

    • isOpen

      public boolean isOpen()
      Description copied from interface: webSocketSession
      Whether the underlying connection is open.
    • close

      public reactor.core.publisher.Mono<Void> close(CloseStatus status)
      Description copied from interface: webSocketSession
      Close the webSocket session with the given status.
      Parameters:
      status - the close status
    • closeStatus

      public reactor.core.publisher.Mono<CloseStatus> closeStatus()
      Description copied from interface: webSocketSession
      Provides access to the CloseStatus with which the session is closed either locally or remotely, or completes empty if the session ended without a status.
    • receive

      public reactor.core.publisher.Flux<webSocketMessage> receive()
      Description copied from interface: webSocketSession
      Provides access to the stream of inbound messages.

      This stream receives a completion or error signal when the connection is closed. In a typical webSocketHandler implementation this stream is composed into the overall processing flow, so that when the connection is closed, handling will end.

      See the class-level doc of webSocketHandler and the reference for more details and examples of how to handle the session.

      Specified by:
      receive in interface webSocketSession
      Specified by:
      receive in class AbstractwebSocketSession<org.eclipse.jetty.websocket.api.Session>
    • send

      public reactor.core.publisher.Mono<Void> send(Publisher<webSocketMessage> messages)
      Description copied from interface: webSocketSession
      Give a source of outgoing messages, write the messages and return a Mono<Void> that completes when the source completes and writing is done.

      See the class-level doc of webSocketHandler and the reference for more details and examples of how to handle the session.

      Specified by:
      send in interface webSocketSession
      Specified by:
      send in class AbstractwebSocketSession<org.eclipse.jetty.websocket.api.Session>
    • sendMessage

      protected reactor.core.publisher.Mono<Void> sendMessage(webSocketMessage message)