# Class WsFrameServer

java.lang.Object
org.apache.tomcat.websocket.WsFrameBase
org.apache.tomcat.websocket.server.WsFrameServer

public class WsFrameServer extends WsFrameBase
WebSocket frame handler for server connections.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class WsFrameBase

  `WsFrameBase.ReadState`

- ## Field Summary

  ### Fields inherited from class WsFrameBase

  `inputBuffer, wsSession`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WsFrameServer(SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo, WsSession wsSession, Transformation transformation, ClassLoader applicationClassLoader)`
  Constructs a new WsFrameServer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Log`
  `getLog()`
  Returns the log instance for this frame.
  `protected Transformation`
  `getTransformation()`
  Returns the transformation applied to this frame.
  `protected boolean`
  `isMasked()`
  Returns whether frames from this peer must be masked.
  `protected boolean`
  `isOpen()`
  Returns whether the connection is open.
  `protected void`
  `resumeProcessing()`
  This method will be invoked when the read operation is resumed.
  `protected void`
  `sendMessageBinary(ByteBuffer msg, boolean last)`
  Sends a binary message to the remote endpoint.
  `protected void`
  `sendMessageText(boolean last)`
  Sends a text message to the remote endpoint.
  `protected void`
  `updateStats(long payloadLength)`
  Hook for updating server side statistics.

  ### Methods inherited from class WsFrameBase

  `byteArrayToLong, changeReadState, changeReadState, getReadState, isSuspended, processInputBuffer, resume, suspend`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### WsFrameServer

    public WsFrameServer(SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo, WsSession wsSession, Transformation transformation, ClassLoader applicationClassLoader)
    Constructs a new WsFrameServer.
    Parameters:
      `socketWrapper` - The socket wrapper
      `upgradeInfo` - The upgrade information
      `wsSession` - The WebSocket session
      `transformation` - The transformation to apply
      `applicationClassLoader` - The application class loader

- ## Method Details

  - ### updateStats

    protected void updateStats(long payloadLength)
    Description copied from class: `WsFrameBase`
    Hook for updating server side statistics. Called on every frame received.
    Overrides:
      `updateStats` in class `WsFrameBase`
    Parameters:
      `payloadLength` - Size of message payload

  - ### isMasked

    protected boolean isMasked()
    Description copied from class: `WsFrameBase`
    Returns whether frames from this peer must be masked.
    Specified by:
      `isMasked` in class `WsFrameBase`
    Returns:
      `true` if frames must be masked

  - ### getTransformation

    protected Transformation getTransformation()
    Description copied from class: `WsFrameBase`
    Returns the transformation applied to this frame.
    Overrides:
      `getTransformation` in class `WsFrameBase`
    Returns:
      the transformation

  - ### isOpen

    protected boolean isOpen()
    Description copied from class: `WsFrameBase`
    Returns whether the connection is open.
    Overrides:
      `isOpen` in class `WsFrameBase`
    Returns:
      `true` if open

  - ### getLog

    protected Log getLog()
    Description copied from class: `WsFrameBase`
    Returns the log instance for this frame.
    Specified by:
      `getLog` in class `WsFrameBase`
    Returns:
      the log instance

  - ### sendMessageText

    protected void sendMessageText(boolean last) throws WsIOException
    Description copied from class: `WsFrameBase`
    Sends a text message to the remote endpoint.
    Overrides:
      `sendMessageText` in class `WsFrameBase`
    Parameters:
      `last` - Whether this is the last fragment of the message
    Throws:
      `WsIOException` - If a WebSocket I/O error occurs

  - ### sendMessageBinary

    protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException
    Description copied from class: `WsFrameBase`
    Sends a binary message to the remote endpoint.
    Overrides:
      `sendMessageBinary` in class `WsFrameBase`
    Parameters:
      `msg` - The message data
      `last` - Whether this is the last fragment of the message
    Throws:
      `WsIOException` - If a WebSocket I/O error occurs

  - ### resumeProcessing

    protected void resumeProcessing()
    Description copied from class: `WsFrameBase`
    This method will be invoked when the read operation is resumed. Since 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.
    Specified by:
      `resumeProcessing` in class `WsFrameBase`