Interface WebSocketFrame.Factory

Enclosing interface:
WebSocketFrame

public static interface WebSocketFrame.Factory

A factory used to create WebSocket frame.

It allows to create frames that comply with the configuration (e.g. max frame size...).

Since:
1.5
Author:
Jeremy Kuhn
  • Method Details

    • binary

      default WebSocketFrame binary(ByteBuf data) throws WebSocketException

      Creates a final binary frame with the specified payload data.

      Parameters:
      data - payload data
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • binary

      WebSocketFrame binary(ByteBuf data, boolean finalFragment) throws WebSocketException

      Creates a binary frame with the specified payload data.

      Parameters:
      data - payload data
      finalFragment - true to create a final frame, false otherwise
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • text

      default WebSocketFrame text(String text) throws WebSocketException

      Creates a final text frame with the specified payload data.

      Parameters:
      text - payload data
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • text

      default WebSocketFrame text(String text, boolean finalFragment) throws WebSocketException

      Creates a text frame with the specified payload data.

      Parameters:
      text - payload data
      finalFragment - true to create a final frame, false otherwise
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • text

      default WebSocketFrame text(ByteBuf data) throws WebSocketException

      Creates a final text frame with the specified payload data.

      Parameters:
      data - payload data
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • text

      WebSocketFrame text(ByteBuf data, boolean finalFragment) throws WebSocketException

      Creates a text frame with the specified payload data.

      Parameters:
      data - payload data
      finalFragment - true to create a final frame, false otherwise
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • continuation

      WebSocketFrame continuation(ByteBuf data, boolean finalFragment) throws WebSocketException

      Creates a continuation frame with the specified payload data.

      Parameters:
      data - payload data
      finalFragment - true to create a final frame, false otherwise
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • ping

      Creates a ping frame with the specified payload data.

      Note that a ping frame must have a payload length of 125 bytes or less as defined by RFC 6455 Section 5.5.

      Parameters:
      data - payload data
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame
    • pong

      Creates a pong frame with the specified payload data.

      Note that a pong frame must have a payload length of 125 bytes or less as defined by RFC 6455 Section 5.5.

      Parameters:
      data - payload data
      Returns:
      a new WebSocket frame
      Throws:
      WebSocketException - if there was an error creating the frame