Enum Class ClosureCode
- All Implemented Interfaces:
Serializable,Comparable<ClosureCode>,Constable
Enumeration representing WebSocket closure codes along with their integer values and internal status.
These codes are defined in RFC 6455 (https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1).
- Since:
- 3.0.5-SNAPSHOT
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIndicates an abnormal closure, meaning that the connection was closed abruptly without sending or receiving a close frame.Indicates that the server is terminating the connection because it received a message that was too large.Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.Indicates that no status code was actually present.Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.Indicates a violation of the WebSocket protocol's policy.Indicates a protocol error, meaning that the endpoint received a message that violates its protocol.Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.Indicates that the service is terminating the connection because it is restarting.Indicates that the connection was closed due to a failure to perform a TLS handshake.Indicates that the message received was too large for the endpoint to process.Indicates that the service is terminating the connection because it encountered an error during the transmission of the response.Indicates that the received message type is unsupported or not expected.Indicates that the endpoint received a message with a payload that it cannot accept. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<ClosureCode>List of ClosureCode values that are considered internal.List of integer values corresponding to ClosureCode values that are considered internal.List of allclosure codesthat are specified in RFC 6455. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClosureCodefromInt(int code) Converts an int to the correspondingClosureCode.intintValue()Retrieves the integer value of the ClosureCode.booleanChecks whether the ClosureCode is considered internal.static ClosureCodeReturns the enum constant of this class with the specified name.static ClosureCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORMAL
Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled. -
GOING_AWAY
Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page. -
PROTOCOL_ERROR
Indicates a protocol error, meaning that the endpoint received a message that violates its protocol. -
UNSUPPORTED
Indicates that the received message type is unsupported or not expected. -
NO_STATUS
Indicates that no status code was actually present. -
ABNORMAL
Indicates an abnormal closure, meaning that the connection was closed abruptly without sending or receiving a close frame. -
UNSUPPORTED_PAYLOAD
Indicates that the endpoint received a message with a payload that it cannot accept. -
POLICY_VIOLATION
Indicates a violation of the WebSocket protocol's policy. -
TOO_LARGE
Indicates that the message received was too large for the endpoint to process. -
SERVER_ERROR
Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. -
SERVICE_ERROR
Indicates that the service is terminating the connection because it is restarting. -
TRY_AGAIN_LATER
Indicates that the service is terminating the connection because it encountered an error during the transmission of the response. -
BAD_GATEWAY
Indicates that the server is terminating the connection because it received a message that was too large. -
TLS_HANDSHAKE_FAIL
Indicates that the connection was closed due to a failure to perform a TLS handshake.
-
-
Field Details
-
SPECIFIED_CODES
List of allclosure codesthat are specified in RFC 6455.- Since:
- 3.4.0-SNAPSHOT
-
INTERNAL_CODES
List of ClosureCode values that are considered internal. -
RAW_INTERNAL_CODES
List of integer values corresponding to ClosureCode values that are considered internal.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
intValue
public int intValue()Retrieves the integer value of the ClosureCode.- Returns:
- The integer value representing the closure code.
-
isInternal
public boolean isInternal()Checks whether the ClosureCode is considered internal.- Returns:
- true if the ClosureCode is considered internal, otherwise false.
-
fromInt
Converts an int to the correspondingClosureCode.- Parameters:
code- The int which should be converted.- Returns:
- The corresponding
ClosureCode.
-