Enum ConnectionStatus

All Implemented Interfaces:
Serializable, Comparable<ConnectionStatus>

public enum ConnectionStatus extends Enum<ConnectionStatus>
Represents the connection status of an audio connection.
  • Enum Constant Details


      public static final ConnectionStatus NOT_CONNECTED
      Indicates that there is no open connection or that the connection was closed by choice, not by error.

      public static final ConnectionStatus SHUTTING_DOWN
      Indicates that JDA was shutdown and no further connections should be established

      public static final ConnectionStatus CONNECTING_AWAITING_ENDPOINT
      JDA is waiting on Discord to send a valid endpoint which to connect the audio websocket to.

      public static final ConnectionStatus CONNECTING_AWAITING_WEBSOCKET_CONNECT
      JDA has received a valid endpoint and is attempting to setup and connect the audio websocket

      public static final ConnectionStatus CONNECTING_AWAITING_AUTHENTICATION
      JDA has connected the audio websocket to Discord and has sent the authentication information, awaiting reply.

      public static final ConnectionStatus CONNECTING_ATTEMPTING_UDP_DISCOVERY
      JDA successfully authenticated the audio websocket and it now attempting UDP discovery. UDP discovery involves opening a UDP socket and sending a packet to a provided Discord remote resource which responds with the external ip and port which the packet was sent from.

      public static final ConnectionStatus CONNECTING_AWAITING_READY
      After determining our external ip and port, JDA forwards this information to Discord so that it can send audio packets for us to properly receive. At this point, JDA is waiting for final websocket READY.

      public static final ConnectionStatus CONNECTED
      The audio connection has been successfully setup and is ready for use.

      public static final ConnectionStatus DISCONNECTED_LOST_PERMISSION
      Indicates that the logged in account lost the Permission.VOICE_CONNECT and cannot connect to the channel.

      public static final ConnectionStatus DISCONNECTED_CHANNEL_DELETED
      Indicates that the channel which the audio connection was connected to was deleted, thus the connection was severed.

      public static final ConnectionStatus DISCONNECTED_REMOVED_FROM_GUILD
      Indicates that the logged in account was removed from the Guild that this audio connection was connected to, thus the connection was severed.

      public static final ConnectionStatus DISCONNECTED_KICKED_FROM_CHANNEL
      Indicates that we were kicked from a channel by a moderator

      public static final ConnectionStatus DISCONNECTED_REMOVED_DURING_RECONNECT
      Indicates that the logged in account was removed from the Guild while reconnecting to the gateway

      public static final ConnectionStatus DISCONNECTED_AUTHENTICATION_FAILURE
      Indicates that our token was not valid.

      public static final ConnectionStatus AUDIO_REGION_CHANGE
      Indicates that the audio connection was closed due to the Region of the audio connection being changed. JDA will automatically attempt to reconnect the audio connection regardless of the value of the AudioManager.isAutoReconnect().

      public static final ConnectionStatus ERROR_LOST_CONNECTION
      Indicates that the connection was lost, either via UDP socket problems or the audio Websocket disconnecting.
      This is typically caused by a brief loss of internet which results in connection loss.
      JDA automatically attempts to resume the session when this error occurs.

      public static final ConnectionStatus ERROR_CANNOT_RESUME
      Indicates that the audio WebSocket was unable to resume an active session.
      JDA automatically attempts to reconnect when this error occurs.

      public static final ConnectionStatus ERROR_WEBSOCKET_UNABLE_TO_CONNECT
      Indicates that the audio Websocket was unable to connect to discord. This could be due to an internet problem causing a connection problem or an error on Discord's side (possibly due to load)
      JDA automatically attempts to reconnect when this error occurs.

      public static final ConnectionStatus ERROR_UNSUPPORTED_ENCRYPTION_MODES
      Indicates that the audio WebSocket was unable to complete a handshake with discord, because discord did not provide any supported encryption modes.
      JDA automatically attempts to reconnect when this error occurs.

      public static final ConnectionStatus ERROR_UDP_UNABLE_TO_CONNECT
      Indicates that the UDP setup failed. This is caused when JDA cannot properly communicate with Discord to discover the system's external IP and port which audio data will be sent from. Typically caused by an internet problem or an overly aggressive NAT port table.
      JDA automatically attempts to reconnect when this error occurs.

      public static final ConnectionStatus ERROR_CONNECTION_TIMEOUT
      Occurs when it takes longer than AudioManager.getConnectTimeout() to establish the Websocket connection and setup the UDP connection.
      JDA automatically attempts to reconnect when this error occurs.
  • Method Details

    • values

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

      public static ConnectionStatus 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.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • shouldReconnect

      public boolean shouldReconnect()