Home / Class/ WebSocketCloseStatus Class — netty Architecture

WebSocketCloseStatus Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc["WebSocketCloseStatus"]
  ebb1ff30_57d7_efdb_f1f8_3cfdfffaf8ed["WebSocketCloseStatus.java"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|defined in| ebb1ff30_57d7_efdb_f1f8_3cfdfffaf8ed
  f5ffd7cd_c9dd_42af_4ac0_ed8dc0c70d31["WebSocketCloseStatus()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| f5ffd7cd_c9dd_42af_4ac0_ed8dc0c70d31
  b258be93_a4c4_8adf_72d5_25b3a83ee008["code()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| b258be93_a4c4_8adf_72d5_25b3a83ee008
  835750d1_7688_a9ca_9778_191e5fdfe37a["String()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| 835750d1_7688_a9ca_9778_191e5fdfe37a
  a96d5049_891d_5850_82e7_094fef859527["compareTo()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| a96d5049_891d_5850_82e7_094fef859527
  319a4884_1d73_2fce_0179_007ed745d2de["equals()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| 319a4884_1d73_2fce_0179_007ed745d2de
  72dfc65b_ee59_1ba8_86cb_3d794d123b06["hashCode()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| 72dfc65b_ee59_1ba8_86cb_3d794d123b06
  04db7e7c_918f_35b9_9b7b_c9368ea9ddea["isValidStatusCode()"]
  723ccf8f_0b7c_4922_a5c1_14d569c39cfc -->|method| 04db7e7c_918f_35b9_9b7b_c9368ea9ddea

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketCloseStatus.java lines 171–330

public final class WebSocketCloseStatus implements Comparable<WebSocketCloseStatus> {

    public static final WebSocketCloseStatus NORMAL_CLOSURE =
        new WebSocketCloseStatus(1000, "Bye");

    public static final WebSocketCloseStatus ENDPOINT_UNAVAILABLE =
        new WebSocketCloseStatus(1001, "Endpoint unavailable");

    public static final WebSocketCloseStatus PROTOCOL_ERROR =
        new WebSocketCloseStatus(1002, "Protocol error");

    public static final WebSocketCloseStatus INVALID_MESSAGE_TYPE =
        new WebSocketCloseStatus(1003, "Invalid message type");

    public static final WebSocketCloseStatus INVALID_PAYLOAD_DATA =
        new WebSocketCloseStatus(1007, "Invalid payload data");

    public static final WebSocketCloseStatus POLICY_VIOLATION =
        new WebSocketCloseStatus(1008, "Policy violation");

    public static final WebSocketCloseStatus MESSAGE_TOO_BIG =
        new WebSocketCloseStatus(1009, "Message too big");

    public static final WebSocketCloseStatus MANDATORY_EXTENSION =
        new WebSocketCloseStatus(1010, "Mandatory extension");

    public static final WebSocketCloseStatus INTERNAL_SERVER_ERROR =
        new WebSocketCloseStatus(1011, "Internal server error");

    public static final WebSocketCloseStatus SERVICE_RESTART =
        new WebSocketCloseStatus(1012, "Service Restart");

    public static final WebSocketCloseStatus TRY_AGAIN_LATER =
        new WebSocketCloseStatus(1013, "Try Again Later");

    public static final WebSocketCloseStatus BAD_GATEWAY =
        new WebSocketCloseStatus(1014, "Bad Gateway");

    // 1004, 1005, 1006, 1015 are reserved and should never be used by user
    //public static final WebSocketCloseStatus SPECIFIC_MEANING = register(1004, "...");

    public static final WebSocketCloseStatus EMPTY =
        new WebSocketCloseStatus(1005, "Empty", false);

    public static final WebSocketCloseStatus ABNORMAL_CLOSURE =
        new WebSocketCloseStatus(1006, "Abnormal closure", false);

    public static final WebSocketCloseStatus TLS_HANDSHAKE_FAILED =
        new WebSocketCloseStatus(1015, "TLS handshake failed", false);

    private final int statusCode;
    private final String reasonText;
    private String text;

    public WebSocketCloseStatus(int statusCode, String reasonText) {
        this(statusCode, reasonText, true);
    }

    public WebSocketCloseStatus(int statusCode, String reasonText, boolean validate) {
        if (validate && !isValidStatusCode(statusCode)) {
            throw new IllegalArgumentException(
                "WebSocket close status code does NOT comply with RFC-6455: " + statusCode);
        }
        this.statusCode = statusCode;
        this.reasonText = checkNotNull(reasonText, "reasonText");
    }

    public int code() {
        return statusCode;
    }

    public String reasonText() {
        return reasonText;
    }

    /**
     * Order of {@link WebSocketCloseStatus} only depends on {@link #code()}.
     */
    @Override
    public int compareTo(WebSocketCloseStatus o) {
        return code() - o.code();

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free