Home / Class/ CloseWebSocketFrame Class — netty Architecture

CloseWebSocketFrame Class — netty Architecture

Architecture documentation for the CloseWebSocketFrame class in CloseWebSocketFrame.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5070406a_c000_8334_1d2d_467605456155["CloseWebSocketFrame"]
  dc21d3e4_61c3_90a7_b7a8_8480f9e78c14["CloseWebSocketFrame.java"]
  5070406a_c000_8334_1d2d_467605456155 -->|defined in| dc21d3e4_61c3_90a7_b7a8_8480f9e78c14
  cf1189d2_d2f2_db19_2075_f4c34b27ff81["CloseWebSocketFrame()"]
  5070406a_c000_8334_1d2d_467605456155 -->|method| cf1189d2_d2f2_db19_2075_f4c34b27ff81
  53e2de4f_9e14_f0f2_fe76_383a5e1dc62a["ByteBuf()"]
  5070406a_c000_8334_1d2d_467605456155 -->|method| 53e2de4f_9e14_f0f2_fe76_383a5e1dc62a
  59dc5b07_ba4b_8eb5_5e85_72f170a21619["statusCode()"]
  5070406a_c000_8334_1d2d_467605456155 -->|method| 59dc5b07_ba4b_8eb5_5e85_72f170a21619
  92d4e388_b108_f78a_197d_50312f8b2a19["String()"]
  5070406a_c000_8334_1d2d_467605456155 -->|method| 92d4e388_b108_f78a_197d_50312f8b2a19
  6c14845e_844b_4dd9_62f4_7775b70d167f["requireValidStatusCode()"]
  5070406a_c000_8334_1d2d_467605456155 -->|method| 6c14845e_844b_4dd9_62f4_7775b70d167f

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java lines 26–206

public class CloseWebSocketFrame extends WebSocketFrame {

    /**
     * Creates a new empty close frame.
     */
    public CloseWebSocketFrame() {
        super(Unpooled.buffer(0));
    }

    /**
     * Creates a new empty close frame with closing status code and reason text
     *
     * @param status
     *            Status code as per <a href="https://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
     *            example, <tt>1000</tt> indicates normal closure.
     */
    public CloseWebSocketFrame(WebSocketCloseStatus status) {
        this(requireValidStatusCode(status.code()), status.reasonText());
    }

    /**
     * Creates a new empty close frame with closing status code and reason text
     *
     * @param status
     *            Status code as per <a href="https://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
     *            example, <tt>1000</tt> indicates normal closure.
     * @param reasonText
     *            Reason text. Set to null if no text.
     */
    public CloseWebSocketFrame(WebSocketCloseStatus status, String reasonText) {
        this(requireValidStatusCode(status.code()), reasonText);
    }

    /**
     * Creates a new empty close frame with closing status code and reason text
     *
     * @param statusCode
     *            Integer status code as per <a href="https://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
     *            example, <tt>1000</tt> indicates normal closure.
     * @param reasonText
     *            Reason text. Set to null if no text.
     */
    public CloseWebSocketFrame(int statusCode, String reasonText) {
        this(true, 0, requireValidStatusCode(statusCode), reasonText);
    }

    /**
     * Creates a new close frame with no losing status code and no reason text
     *
     * @param finalFragment
     *            flag indicating if this frame is the final fragment
     * @param rsv
     *            reserved bits used for protocol extensions.
     */
    public CloseWebSocketFrame(boolean finalFragment, int rsv) {
        this(finalFragment, rsv, Unpooled.buffer(0));
    }

    /**
     * Creates a new close frame with closing status code and reason text
     *
     * @param finalFragment
     *            flag indicating if this frame is the final fragment
     * @param rsv
     *            reserved bits used for protocol extensions
     * @param statusCode
     *            Integer status code as per <a href="https://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
     *            example, <tt>1000</tt> indicates normal closure.
     * @param reasonText
     *            Reason text. Set to null if no text.
     */
    public CloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, String reasonText) {
        super(finalFragment, rsv, newBinaryData(requireValidStatusCode(statusCode), reasonText));
    }

    private static ByteBuf newBinaryData(int statusCode, String reasonText) {
        if (reasonText == null) {
            reasonText = StringUtil.EMPTY_STRING;
        }

        ByteBuf binaryData = Unpooled.buffer(2 + reasonText.length());

Frequently Asked Questions

What is the CloseWebSocketFrame class?
CloseWebSocketFrame is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java.
Where is CloseWebSocketFrame defined?
CloseWebSocketFrame is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java at line 26.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free