Class CloseWebSocketFrame

java.lang.Object
io.netty.buffer.DefaultByteBufHolder
io.netty.handler.codec.http.websocketx.WebSocketFrame
io.netty.handler.codec.http.websocketx.CloseWebSocketFrame
All Implemented Interfaces:
io.netty.buffer.ByteBufHolder, io.netty.util.ReferenceCounted

public class CloseWebSocketFrame extends WebSocketFrame
Web Socket Frame for closing the connection.
  • Constructor Details

    • CloseWebSocketFrame

      public CloseWebSocketFrame()
      Creates a new empty close frame.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(WebSocketCloseStatus status)
      Creates a new empty close frame with closing status code and reason text
      Parameters:
      status - Status code as per RFC 6455. For example, 1000 indicates normal closure.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(WebSocketCloseStatus status, String reasonText)
      Creates a new empty close frame with closing status code and reason text
      Parameters:
      status - Status code as per RFC 6455. For example, 1000 indicates normal closure.
      reasonText - Reason text. Set to null if no text.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(int statusCode, String reasonText)
      Creates a new empty close frame with closing status code and reason text
      Parameters:
      statusCode - Integer status code as per RFC 6455. For example, 1000 indicates normal closure.
      reasonText - Reason text. Set to null if no text.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(boolean finalFragment, int rsv)
      Creates a new close frame with no losing status code and no reason text
      Parameters:
      finalFragment - flag indicating if this frame is the final fragment
      rsv - reserved bits used for protocol extensions.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, String reasonText)
      Creates a new close frame with closing status code and reason text
      Parameters:
      finalFragment - flag indicating if this frame is the final fragment
      rsv - reserved bits used for protocol extensions
      statusCode - Integer status code as per RFC 6455. For example, 1000 indicates normal closure.
      reasonText - Reason text. Set to null if no text.
    • CloseWebSocketFrame

      public CloseWebSocketFrame(boolean finalFragment, int rsv, io.netty.buffer.ByteBuf binaryData)
      Creates a new close frame
      Parameters:
      finalFragment - flag indicating if this frame is the final fragment
      rsv - reserved bits used for protocol extensions
      binaryData - the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string.
  • Method Details

    • statusCode

      public int statusCode()
      Returns the closing status code as per RFC 6455. If a status code is set, -1 is returned.
    • reasonText

      public String reasonText()
      Returns the reason text as per RFC 6455 If a reason text is not supplied, an empty string is returned.
    • copy

      public CloseWebSocketFrame copy()
      Specified by:
      copy in interface io.netty.buffer.ByteBufHolder
      Overrides:
      copy in class WebSocketFrame
    • duplicate

      public CloseWebSocketFrame duplicate()
      Specified by:
      duplicate in interface io.netty.buffer.ByteBufHolder
      Overrides:
      duplicate in class WebSocketFrame
    • retainedDuplicate

      public CloseWebSocketFrame retainedDuplicate()
      Specified by:
      retainedDuplicate in interface io.netty.buffer.ByteBufHolder
      Overrides:
      retainedDuplicate in class WebSocketFrame
    • replace

      public CloseWebSocketFrame replace(io.netty.buffer.ByteBuf content)
      Specified by:
      replace in interface io.netty.buffer.ByteBufHolder
      Specified by:
      replace in class WebSocketFrame
    • retain

      public CloseWebSocketFrame retain()
      Specified by:
      retain in interface io.netty.buffer.ByteBufHolder
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Overrides:
      retain in class WebSocketFrame
    • retain

      public CloseWebSocketFrame retain(int increment)
      Specified by:
      retain in interface io.netty.buffer.ByteBufHolder
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Overrides:
      retain in class WebSocketFrame
    • touch

      public CloseWebSocketFrame touch()
      Specified by:
      touch in interface io.netty.buffer.ByteBufHolder
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
      Overrides:
      touch in class WebSocketFrame
    • touch

      public CloseWebSocketFrame touch(Object hint)
      Specified by:
      touch in interface io.netty.buffer.ByteBufHolder
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
      Overrides:
      touch in class WebSocketFrame