Class CoreSession.Empty

All Implemented Interfaces:
Configuration, Configuration.Customizer, CoreSession, IncomingFrames, OutgoingFrames
Enclosing interface:
CoreSession

public static class CoreSession.Empty extends Configuration.ConfigurationCustomizer implements CoreSession
  • Constructor Details

    • Empty

      public Empty()
  • Method Details

    • getNegotiatedSubProtocol

      public String getNegotiatedSubProtocol()
      Specified by:
      getNegotiatedSubProtocol in interface CoreSession
    • getNegotiatedExtensions

      public List<ExtensionConfig> getNegotiatedExtensions()
      Description copied from interface: CoreSession
      The negotiated WebSocket Extension Configurations for this session.
      Specified by:
      getNegotiatedExtensions in interface CoreSession
      Returns:
      the list of Negotiated Extension Configurations for this session.
    • getParameterMap

      public Map<String,List<String>> getParameterMap()
      Description copied from interface: CoreSession
      The parameter map (from URI Query) for the active session.
      Specified by:
      getParameterMap in interface CoreSession
      Returns:
      the immutable map of parameters
    • getProtocolVersion

      public String getProtocolVersion()
      Description copied from interface: CoreSession
      The active Sec-WebSocket-Version (protocol version) in use.
      Specified by:
      getProtocolVersion in interface CoreSession
      Returns:
      the protocol version in use.
    • getRequestURI

      public URI getRequestURI()
      Description copied from interface: CoreSession
      The active connection's Request URI. This is the URI of the upgrade request and is typically http: or https: rather than the ws: or wss: scheme.
      Specified by:
      getRequestURI in interface CoreSession
      Returns:
      the absolute URI (including Query string)
    • isSecure

      public boolean isSecure()
      Description copied from interface: CoreSession
      The active connection's Secure status indicator.
      Specified by:
      isSecure in interface CoreSession
      Returns:
      true if connection is secure (similar in role to HttpServletRequest.isSecure())
    • abort

      public void abort()
      Description copied from interface: CoreSession
      Issue a harsh abort of the underlying connection.

      This will terminate the connection, without sending a websocket close frame. No WebSocket Protocol close handshake will be performed.

      Once called, any read/write activity on the websocket from this point will be indeterminate. This can result in the FrameHandler.onError(Throwable, Callback) event being called indicating any issue that arises.

      Once the underlying connection has been determined to be closed, the FrameHandler.onClosed(CloseStatus, Callback) event will be called.

      Specified by:
      abort in interface CoreSession
    • getBehavior

      public Behavior getBehavior()
      Specified by:
      getBehavior in interface CoreSession
      Returns:
      Client or Server behaviour
    • getWebSocketComponents

      public WebSocketComponents getWebSocketComponents()
      Specified by:
      getWebSocketComponents in interface CoreSession
      Returns:
      the WebSocketComponents instance in use for this Connection.
    • getByteBufferPool

      public ByteBufferPool getByteBufferPool()
      Specified by:
      getByteBufferPool in interface CoreSession
      Returns:
      The shared ByteBufferPool
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Description copied from interface: CoreSession
      The Local Socket Address for the connection

      Do not assume that this will return a InetSocketAddress in all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supporting InetSocketAddress

      Specified by:
      getLocalAddress in interface CoreSession
      Returns:
      the SocketAddress for the local connection, or null if not supported by Session
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
      Description copied from interface: CoreSession
      The Remote Socket Address for the connection

      Do not assume that this will return a InetSocketAddress in all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supporting InetSocketAddress

      Specified by:
      getRemoteAddress in interface CoreSession
      Returns:
      the SocketAddress for the remote connection, or null if not supported by Session
    • isInputOpen

      public boolean isInputOpen()
      Specified by:
      isInputOpen in interface CoreSession
      Returns:
      True if the websocket is open inbound
    • isOutputOpen

      public boolean isOutputOpen()
      Specified by:
      isOutputOpen in interface CoreSession
      Returns:
      True if the websocket is open outbound
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface CoreSession
    • flush

      public void flush(Callback callback)
      Specified by:
      flush in interface CoreSession
    • close

      public void close(Callback callback)
      Description copied from interface: CoreSession
      Initiate close handshake, no payload (no declared status code or reason phrase).
      Specified by:
      close in interface CoreSession
      Parameters:
      callback - the callback to track close frame sent (or failed).
    • close

      public void close(int statusCode, String reason, Callback callback)
      Description copied from interface: CoreSession
      Initiate close handshake with provided status code and optional reason phrase.
      Specified by:
      close in interface CoreSession
      Parameters:
      statusCode - the status code (should be a valid status code that can be sent).
      reason - optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol).
      callback - the callback to track close frame sent (or failed).
    • close

      public void close(CloseStatus closeStatus, Callback callback)
      Description copied from interface: CoreSession
      Initiate close handshake with a provided CloseStatus.
      Specified by:
      close in interface CoreSession
      Parameters:
      closeStatus - the close status containing (statusCode, reason, and optional Throwable cause).
      callback - the callback to track close frame sent (or failed).
    • demand

      public void demand()
      Description copied from interface: CoreSession

      Manages flow control by indicating demand for a WebSocket frame.

      A call to FrameHandler.onFrame(Frame, Callback) will only be made if there is demand.

      If a previous demand has not been fulfilled this will throw ReadPendingException

      FrameHandler.onFrame(Frame, Callback).
      Specified by:
      demand in interface CoreSession
    • onFrame

      public void onFrame(Frame frame, Callback callback)
      Description copied from interface: IncomingFrames

      Process the incoming frame.

      Note: if you need to hang onto any information from the frame, be sure to copy it, as the information contained in the Frame will be released and/or reused by the implementation.

      Failure of the callback will propagate the failure back to the CoreSession to fail the connection and attempt to send a close Frame if one has not been sent.

      Specified by:
      onFrame in interface IncomingFrames
      Parameters:
      frame - the frame to process.
      callback - the read completion.
    • sendFrame

      public void sendFrame(Frame frame, Callback callback, boolean batch)
      Description copied from interface: OutgoingFrames
      A frame, and optional callback, intended for the network layer.

      Note: the frame can undergo many transformations in the various layers and extensions present in the implementation.

      If you are implementing a mutation, you are obliged to handle the incoming Callback appropriately.

      Specified by:
      sendFrame in interface OutgoingFrames
      Parameters:
      frame - the frame to eventually write to the network layer.
      callback - the callback to notify when the frame is written.
      batch - the batch mode requested by the sender.
    • isRsv1Used

      public boolean isRsv1Used()
      Specified by:
      isRsv1Used in interface CoreSession
      Returns:
      true if an extension has been negotiated which uses the RSV1 bit.
    • isRsv2Used

      public boolean isRsv2Used()
      Specified by:
      isRsv2Used in interface CoreSession
      Returns:
      true if an extension has been negotiated which uses the RSV2 bit.
    • isRsv3Used

      public boolean isRsv3Used()
      Specified by:
      isRsv3Used in interface CoreSession
      Returns:
      true if an extension has been negotiated which uses the RSV3 bit.