Class WsFrameBase

  • Direct Known Subclasses:
    WsFrameClient, WsFrameServer

    public abstract class WsFrameBase
    extends java.lang.Object
    Takes the ServletInputStream, processes the WebSocket frames it contains and extracts the messages. WebSocket Pings received will be responded to automatically without any action required by the application.
    • Field Detail

      • wsSession

        protected final WsSession wsSession
      • inputBuffer

        protected final java.nio.ByteBuffer inputBuffer
    • Method Detail

      • processInputBuffer

        protected void processInputBuffer()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • isMasked

        protected abstract boolean isMasked()
      • getLog

        protected abstract Log getLog()
      • updateStats

        protected void updateStats​(long payloadLength)
        Hook for updating server side statistics. Called on every frame received.
        Parameters:
        payloadLength - Size of message payload
      • sendMessageBinary

        protected void sendMessageBinary​(java.nio.ByteBuffer msg,
                                         boolean last)
                                  throws WsIOException
        Throws:
        WsIOException
      • byteArrayToLong

        protected static long byteArrayToLong​(byte[] b,
                                              int start,
                                              int len)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • isOpen

        protected boolean isOpen()
      • suspend

        public void suspend()
      • resume

        public void resume()
      • isSuspended

        protected boolean isSuspended()
      • resumeProcessing

        protected abstract void resumeProcessing()
        This method will be invoked when the read operation is resumed. As the suspend of the read operation can be invoked at any time, when implementing this method one should consider that there might still be data remaining into the internal buffers that needs to be processed before reading again from the socket.