Module swim.io.ws
Package swim.io.ws

Class AbstractWebSocket<I,O>

java.lang.Object
swim.io.ws.AbstractWebSocket<I,O>
All Implemented Interfaces:
FlowContext, IpContext, WebSocket<I,O>

public abstract class AbstractWebSocket<I,O> extends Object implements WebSocket<I,O>, IpContext, FlowContext
  • Field Details

  • Constructor Details

    • AbstractWebSocket

      public AbstractWebSocket()
  • Method Details

    • webSocketContext

      public WebSocketContext<I,O> webSocketContext()
      Specified by:
      webSocketContext in interface WebSocket<I,O>
    • setWebSocketContext

      public void setWebSocketContext(WebSocketContext<I,O> context)
      Specified by:
      setWebSocketContext in interface WebSocket<I,O>
    • idleTimeout

      public long idleTimeout()
      Specified by:
      idleTimeout in interface WebSocket<I,O>
    • doRead

      public void doRead()
      Specified by:
      doRead in interface WebSocket<I,O>
    • didRead

      public void didRead(WsFrame<? extends I> frame)
      Specified by:
      didRead in interface WebSocket<I,O>
    • doWrite

      public void doWrite()
      Specified by:
      doWrite in interface WebSocket<I,O>
    • didWrite

      public void didWrite(WsFrame<? extends O> frame)
      Specified by:
      didWrite in interface WebSocket<I,O>
    • didUpgrade

      public void didUpgrade(HttpRequest<?> httpRequest, HttpResponse<?> httpResponse)
      Specified by:
      didUpgrade in interface WebSocket<I,O>
    • willConnect

      public void willConnect()
      Specified by:
      willConnect in interface WebSocket<I,O>
    • didConnect

      public void didConnect()
      Specified by:
      didConnect in interface WebSocket<I,O>
    • willSecure

      public void willSecure()
      Specified by:
      willSecure in interface WebSocket<I,O>
    • didSecure

      public void didSecure()
      Specified by:
      didSecure in interface WebSocket<I,O>
    • willBecome

      public void willBecome(IpSocket socket)
      Specified by:
      willBecome in interface WebSocket<I,O>
    • didBecome

      public void didBecome(IpSocket socket)
      Specified by:
      didBecome in interface WebSocket<I,O>
    • didTimeout

      public void didTimeout()
      Specified by:
      didTimeout in interface WebSocket<I,O>
    • didDisconnect

      public void didDisconnect()
      Specified by:
      didDisconnect in interface WebSocket<I,O>
    • didFail

      public void didFail(Throwable error)
      Specified by:
      didFail in interface WebSocket<I,O>
    • isConnected

      public boolean isConnected()
      Description copied from interface: IpContext
      Returns true if the underlying network channel is currently connected.
      Specified by:
      isConnected in interface IpContext
    • isClient

      public boolean isClient()
      Description copied from interface: IpContext
      Returns true if the underlying network channel initiated an outgoing connection.
      Specified by:
      isClient in interface IpContext
    • isServer

      public boolean isServer()
      Description copied from interface: IpContext
      Returns true if the underlying network channel accepted an incoming connection.
      Specified by:
      isServer in interface IpContext
    • isSecure

      public boolean isSecure()
      Description copied from interface: IpContext
      Returns true if the underlying network transport is encrypted.
      Specified by:
      isSecure in interface IpContext
    • securityProtocol

      public String securityProtocol()
      Description copied from interface: IpContext
      Returns the name of the transport-layer security protocol used by the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not secure.
      Specified by:
      securityProtocol in interface IpContext
    • cipherSuite

      public String cipherSuite()
      Description copied from interface: IpContext
      Returns the cryptographic cipher suite used by the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not secure.
      Specified by:
      cipherSuite in interface IpContext
    • localAddress

      public InetSocketAddress localAddress()
      Description copied from interface: IpContext
      Returns the IP address and port of the local endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected.
      Specified by:
      localAddress in interface IpContext
    • localPrincipal

      public Principal localPrincipal()
      Description copied from interface: IpContext
      Returns the authenticated identity of the local endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.
      Specified by:
      localPrincipal in interface IpContext
    • localCertificates

      public Collection<Certificate> localCertificates()
      Description copied from interface: IpContext
      Returns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.
      Specified by:
      localCertificates in interface IpContext
    • remoteAddress

      public InetSocketAddress remoteAddress()
      Description copied from interface: IpContext
      Returns the IP address and port of the remote endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected.
      Specified by:
      remoteAddress in interface IpContext
    • remotePrincipal

      public Principal remotePrincipal()
      Description copied from interface: IpContext
      Returns the authenticated identity of the remote endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.
      Specified by:
      remotePrincipal in interface IpContext
    • remoteCertificates

      public Collection<Certificate> remoteCertificates()
      Description copied from interface: IpContext
      Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returns null if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.
      Specified by:
      remoteCertificates in interface IpContext
    • flowControl

      public FlowControl flowControl()
      Description copied from interface: FlowContext
      Returns the current FlowControl state of the underlying network channel.
      Specified by:
      flowControl in interface FlowContext
    • flowControl

      public void flowControl(FlowControl flowControl)
      Description copied from interface: FlowContext
      Enqueues an atomic replacement of the underlying network channel's flow control state with a new flowControl.
      Specified by:
      flowControl in interface FlowContext
    • flowControl

      public FlowControl flowControl(FlowModifier flowModifier)
      Description copied from interface: FlowContext
      Enqueues an atomic modification to the underlying network channel's flow control state by applying a flowModifier delta.
      Specified by:
      flowControl in interface FlowContext
    • wsSettings

      public WsSettings wsSettings()
    • read

      public <I2 extends I> void read(Decoder<I2> payloadDecoder)
    • read

      public <I2 extends I> void read(WsOpcode frameType, Decoder<I2> payloadDecoder)
    • write

      public <O2 extends O> void write(WsDataFrame<O2> frame)
    • write

      public <O2 extends O> void write(WsControlFrame<?,O2> frame)
    • become

      public void become(IpSocket socket)
    • close

      public void close()