CloseReason.CloseCodes (WebSocket 2.2 API Documentation - Apache Tomcat 11.0.24)
Description: declaration: package: jakarta.websocket, class: CloseReason, enum: CloseCodes

# Enum Class CloseReason.CloseCodes

java.lang.Object
java.lang.Enum<CloseReason.CloseCodes>
jakarta.websocket.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 Constants
  Enum Constant
  Description
  `CANNOT_ACCEPT`
  Indicates that the endpoint is terminating the connection because it has received a type of data it cannot accept.
  `CLOSED_ABNORMALLY`
  Indicates that the connection was closed abnormally without receiving a close frame.
  `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.
  `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.
  `NO_STATUS_CODE`
  Indicates that no status code was included in the closing frame.
  `NORMAL_CLOSURE`
  Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
  `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.
  `PROTOCOL_ERROR`
  Indicates that the endpoint is terminating the connection due to a protocol error.
  `RESERVED`
  Reserved.
  `SERVICE_RESTART`
  Indicates that the server is restarting.
  `TLS_HANDSHAKE_FAILURE`
  Indicates that the connection was closed due to a failure to perform a TLS handshake.
  `TOO_BIG`
  Indicates that the endpoint is terminating the connection because it has received a message that is too big to process.
  `TRY_AGAIN_LATER`
  Indicates that the server is experiencing a temporary condition and the client should try to connect again later.
  `UNEXPECTED_CONDITION`
  Indicates that the server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
  `VIOLATED_POLICY`
  Indicates that the endpoint is terminating the connection because it has received a message that violates its policy.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CloseReason.CloseCode`
  `getCloseCode(int code)`
  Returns the `CloseReason.CloseCode` for the given numeric code value.
  `int`
  `getCode()`
  Returns the numeric value of this close code.
  `static CloseReason.CloseCodes`
  `valueOf(String name)`
  Returns 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.

  ### Methods inherited from class Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### NORMAL_CLOSURE

    public static final CloseReason.CloseCodes NORMAL_CLOSURE
    Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.

  - ### GOING_AWAY

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes PROTOCOL_ERROR
    Indicates that the endpoint is terminating the connection due to a protocol error.

  - ### CANNOT_ACCEPT

    public static final CloseReason.CloseCodes CANNOT_ACCEPT
    Indicates that the endpoint is terminating the connection because it has received a type of data it cannot accept.

  - ### RESERVED

    public static final CloseReason.CloseCodes RESERVED
    Reserved. The specific meaning might be defined in the future.

  - ### NO_STATUS_CODE

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes VIOLATED_POLICY
    Indicates that the endpoint is terminating the connection because it has received a message that violates its policy.

  - ### TOO_BIG

    public static final CloseReason.CloseCodes TOO_BIG
    Indicates that the endpoint is terminating the connection because it has received a message that is too big to process.

  - ### NO_EXTENSION

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes 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

    public static final CloseReason.CloseCodes SERVICE_RESTART
    Indicates that the server is restarting. A client may choose to reconnect.

  - ### TRY_AGAIN_LATER

    public static final CloseReason.CloseCodes TRY_AGAIN_LATER
    Indicates that the server is experiencing a temporary condition and the client should try to connect again later.

  - ### TLS_HANDSHAKE_FAILURE

    public static final CloseReason.CloseCodes 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

    public static CloseReason.CloseCodes[] 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

    public static CloseReason.CloseCodes valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null

  - ### getCloseCode

    public static CloseReason.CloseCode getCloseCode(int code)
    Returns the `CloseReason.CloseCode` for 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:
      `getCode` in interface `CloseReason.CloseCode`
    Returns:
      The numeric close code value