Enum Class CloseReason.CloseCodes
- All Implemented Interfaces:
CloseReason.CloseCode, Serializable, Comparable<CloseReason.CloseCodes>, Constable
- Enclosing class:
CloseReason
public static enum CloseReason.CloseCodes
extends Enum<CloseReason.CloseCodes>
implements CloseReason.CloseCode
Standard WebSocket close codes as defined by RFC 6455 and related specifications.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIndicates that the endpoint is terminating the connection because it has received a type of data it cannot accept.Indicates that the connection was closed abnormally without receiving a close frame.Indicates that the endpoint is going away, either because the browser is navigating away from the page, or because the server is shutting down.Indicates that the client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't return them in the handshake response.Indicates that no status code was included in the closing frame.Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.Indicates that the endpoint is terminating the connection because it has received a message that contains data that is not consistent with the type of the message.Indicates that the endpoint is terminating the connection due to a protocol error.Reserved.Indicates that the server is restarting.Indicates that the connection was closed due to a failure to perform a TLS handshake.Indicates that the endpoint is terminating the connection because it has received a message that is too big to process.Indicates that the server is experiencing a temporary condition and the client should try to connect again later.Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.Indicates that the endpoint is terminating the connection because it has received a message that violates its policy. -
Method Summary
Modifier and TypeMethodDescriptionstatic CloseReason.CloseCodegetCloseCode(int code) Returns theCloseReason.CloseCodefor the given numeric code value.intgetCode()Returns the numeric value of this close code.static CloseReason.CloseCodesReturns the enum constant of this class with the specified name.static CloseReason.CloseCodes[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORMAL_CLOSURE
Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled. -
GOING_AWAY
Indicates that the endpoint is going away, either because the browser is navigating away from the page, or because the server is shutting down. -
PROTOCOL_ERROR
Indicates that the endpoint is terminating the connection due to a protocol error. -
CANNOT_ACCEPT
Indicates that the endpoint is terminating the connection because it has received a type of data it cannot accept. -
RESERVED
Reserved. The specific meaning might be defined in the future. -
NO_STATUS_CODE
Indicates that no status code was included in the closing frame. This value is reserved and must not be set as a status code in a Close control frame. -
CLOSED_ABNORMALLY
Indicates that the connection was closed abnormally without receiving a close frame. This value is reserved and must not be set as a status code in a Close control frame. -
NOT_CONSISTENT
Indicates that the endpoint is terminating the connection because it has received a message that contains data that is not consistent with the type of the message. -
VIOLATED_POLICY
Indicates that the endpoint is terminating the connection because it has received a message that violates its policy. -
TOO_BIG
Indicates that the endpoint is terminating the connection because it has received a message that is too big to process. -
NO_EXTENSION
Indicates that the client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't return them in the handshake response. -
UNEXPECTED_CONDITION
Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. -
SERVICE_RESTART
Indicates that the server is restarting. A client may choose to reconnect. -
TRY_AGAIN_LATER
Indicates that the server is experiencing a temporary condition and the client should try to connect again later. -
TLS_HANDSHAKE_FAILURE
Indicates that the connection was closed due to a failure to perform a TLS handshake. This value is reserved and must not be set as a status code in a Close control frame.
-
-
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
-
getCloseCode
Returns theCloseReason.CloseCodefor the given numeric code value.- Parameters:
code- The numeric close code value- Returns:
- The corresponding
CloseReason.CloseCode - Throws:
IllegalArgumentException- if the code is not a valid close code
-
getCode
public int getCode()Returns the numeric value of this close code.- Specified by:
getCodein interfaceCloseReason.CloseCode- Returns:
- The numeric close code value
-