Interface WebSocketPolicy

All Known Subinterfaces:
JettyWebSocketServletFactory, Session
All Known Implementing Classes:
JettyWebSocketServerContainer, WebSocketClient, WebSocketSession

public interface WebSocketPolicy
Settings for WebSocket operations.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    The duration that a websocket may be idle before being closed by the implementation
    int
    The input (read from network layer) buffer size.
    long
    Get the maximum size of a binary message during parsing.
    long
    The maximum payload size of any WebSocket Frame which can be received.
    long
    Get the maximum size of a text message during parsing.
    int
    The output (write to network layer) buffer size.
    boolean
    If true, frames are automatically fragmented to respect the maximum frame size.
    void
    setAutoFragment(boolean autoFragment)
    If set to true, frames are automatically fragmented to respect the maximum frame size.
    void
    The duration that a websocket may be idle before being closed by the implementation
    void
    The input (read from network layer) buffer size.
    void
    The maximum size of a binary message during parsing/generating.
    void
    setMaxFrameSize(long maxFrameSize)
    The maximum payload size of any WebSocket Frame which can be received.
    void
    The maximum size of a text message during parsing/generating.
    void
    The output (write to network layer) buffer size.
  • Method Details

    • getBehavior

      WebSocketBehavior getBehavior()
    • getIdleTimeout

      Duration getIdleTimeout()
      The duration that a websocket may be idle before being closed by the implementation
      Returns:
      the timeout duration
    • getInputBufferSize

      int getInputBufferSize()
      The input (read from network layer) buffer size.

      This is the raw read operation buffer size, before the parsing of the websocket frames.

      Returns:
      the raw network buffer input size.
    • getOutputBufferSize

      int getOutputBufferSize()
      The output (write to network layer) buffer size.

      This is the raw write operation buffer size and has no relationship to the websocket frame.

      Returns:
      the raw network buffer output size.
    • getMaxBinaryMessageSize

      long getMaxBinaryMessageSize()
      Get the maximum size of a binary message during parsing.

      This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling binary messages. This applies to individual frames, whole message handling, and partial message handling.

      Binary messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE

      Returns:
      the maximum size of a binary message
    • getMaxTextMessageSize

      long getMaxTextMessageSize()
      Get the maximum size of a text message during parsing.

      This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling text messages. This applies to individual frames, whole message handling, and partial message handling.

      Text messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE

      Returns:
      the maximum size of a text message.
    • getMaxFrameSize

      long getMaxFrameSize()
      The maximum payload size of any WebSocket Frame which can be received.
      Returns:
      the maximum size of a WebSocket Frame.
    • isAutoFragment

      boolean isAutoFragment()
      If true, frames are automatically fragmented to respect the maximum frame size.
      Returns:
      whether to automatically fragment incoming WebSocket Frames.
    • setIdleTimeout

      void setIdleTimeout(Duration duration)
      The duration that a websocket may be idle before being closed by the implementation
      Parameters:
      duration - the timeout duration (may not be null or negative)
    • setInputBufferSize

      void setInputBufferSize(int size)
      The input (read from network layer) buffer size.
      Parameters:
      size - the size in bytes
    • setOutputBufferSize

      void setOutputBufferSize(int size)
      The output (write to network layer) buffer size.
      Parameters:
      size - the size in bytes
    • setMaxBinaryMessageSize

      void setMaxBinaryMessageSize(long size)
      The maximum size of a binary message during parsing/generating.

      Binary messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE

      Parameters:
      size - the maximum allowed size of a binary message.
    • setMaxTextMessageSize

      void setMaxTextMessageSize(long size)
      The maximum size of a text message during parsing/generating.

      Text messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE

      Parameters:
      size - the maximum allowed size of a text message.
    • setMaxFrameSize

      void setMaxFrameSize(long maxFrameSize)
      The maximum payload size of any WebSocket Frame which can be received.

      WebSocket Frames over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE

      Parameters:
      maxFrameSize - the maximum allowed size of a WebSocket Frame.
    • setAutoFragment

      void setAutoFragment(boolean autoFragment)
      If set to true, frames are automatically fragmented to respect the maximum frame size.
      Parameters:
      autoFragment - whether to automatically fragment incoming WebSocket Frames.