Enum CloseCode

java.lang.Object
java.lang.Enum<CloseCode>
net.dv8tion.jda.api.requests.CloseCode
All Implemented Interfaces:
Serializable, Comparable<CloseCode>

public enum CloseCode extends Enum<CloseCode>
Constants representing main gateway close codes with association to an explaining message.
This was inspired from the official documentation
  • Enum Constant Details

    • RECONNECT

      public static final CloseCode RECONNECT
    • GRACEFUL_CLOSE

      public static final CloseCode GRACEFUL_CLOSE
    • CLOUD_FLARE_LOAD

      public static final CloseCode CLOUD_FLARE_LOAD
    • INTERNAL_SERVER_ERROR

      public static final CloseCode INTERNAL_SERVER_ERROR
    • UNKNOWN_ERROR

      public static final CloseCode UNKNOWN_ERROR
    • UNKNOWN_OPCODE

      public static final CloseCode UNKNOWN_OPCODE
    • DECODE_ERROR

      public static final CloseCode DECODE_ERROR
    • NOT_AUTHENTICATED

      public static final CloseCode NOT_AUTHENTICATED
    • AUTHENTICATION_FAILED

      public static final CloseCode AUTHENTICATION_FAILED
    • ALREADY_AUTHENTICATED

      public static final CloseCode ALREADY_AUTHENTICATED
    • INVALID_SEQ

      public static final CloseCode INVALID_SEQ
    • RATE_LIMITED

      public static final CloseCode RATE_LIMITED
    • SESSION_TIMEOUT

      public static final CloseCode SESSION_TIMEOUT
    • INVALID_SHARD

      public static final CloseCode INVALID_SHARD
    • SHARDING_REQUIRED

      public static final CloseCode SHARDING_REQUIRED
    • INVALID_INTENTS

      public static final CloseCode INVALID_INTENTS
    • DISALLOWED_INTENTS

      public static final CloseCode DISALLOWED_INTENTS
  • Method Details

    • values

      public static CloseCode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static CloseCode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public int getCode()
      The integer code in the form of 4xxx/1xxx
      Returns:
      The integer representation for this CloseCode
    • getMeaning

      @Nonnull public String getMeaning()
      The message which further explains the reason for this close code's occurrence
      Returns:
      The reason for this close
    • isReconnect

      public boolean isReconnect()
      Whether the gateway client will attempt to reconnect when this close code appears
      Returns:
      Whether the WebSocketClient will attempt to reconnect
    • toString

      public String toString()
      Overrides:
      toString in class Enum<CloseCode>
    • from

      @Nullable public static CloseCode from(int code)
      Retrieves the CloseCode representation for the specified integer close code
      Parameters:
      code - The close code to match
      Returns:
      The CloseCode field matching the specified integer or null if no match was found