Package net.dv8tion.jda.api.audio.hooks
Enum ConnectionStatus
- java.lang.Object
-
- java.lang.Enum<ConnectionStatus>
-
- net.dv8tion.jda.api.audio.hooks.ConnectionStatus
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConnectionStatus>
public enum ConnectionStatus extends java.lang.Enum<ConnectionStatus>
Represents the connection status of an audio connection.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUDIO_REGION_CHANGE
Indicates that the audio connection was closed due to theRegion
of the audio connection being changed.CONNECTED
The audio connection has been successfully setup and is ready for use.CONNECTING_ATTEMPTING_UDP_DISCOVERY
JDA successfully authenticated the audio websocket and it now attempting UDP discovery.CONNECTING_AWAITING_AUTHENTICATION
JDA has connected the audio websocket to Discord and has sent the authentication information, awaiting reply.CONNECTING_AWAITING_ENDPOINT
JDA is waiting on Discord to send a valid endpoint which to connect the audio websocket to.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.CONNECTING_AWAITING_WEBSOCKET_CONNECT
JDA has received a valid endpoint and is attempting to setup and connect the audio websocketDISCONNECTED_AUTHENTICATION_FAILURE
Indicates that our token was not valid.DISCONNECTED_CHANNEL_DELETED
Indicates that the channel which the audio connection was connected to was deleted, thus the connection was severed.DISCONNECTED_KICKED_FROM_CHANNEL
Indicates that we were kicked from a channel by a moderatorDISCONNECTED_LOST_PERMISSION
Indicates that the logged in account lost thePermission.VOICE_CONNECT
and cannot connect to the channel.DISCONNECTED_REMOVED_DURING_RECONNECT
Indicates that the logged in account was removed from theGuild
while reconnecting to the gatewayDISCONNECTED_REMOVED_FROM_GUILD
Indicates that the logged in account was removed from theGuild
that this audio connection was connected to, thus the connection was severed.ERROR_CANNOT_RESUME
Indicates that the audio WebSocket was unable to resume an active session.ERROR_CONNECTION_TIMEOUT
Occurs when it takes longer thanAudioManager.getConnectTimeout()
to establish the Websocket connection and setup the UDP connection.ERROR_LOST_CONNECTION
Indicates that the connection was lost, either via UDP socket problems or the audio Websocket disconnecting.ERROR_UDP_UNABLE_TO_CONNECT
Indicates that the UDP setup failed.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.ERROR_WEBSOCKET_UNABLE_TO_CONNECT
Indicates that the audio Websocket was unable to connect to discord.NOT_CONNECTED
Indicates that there is no open connection or that the connection was closed by choice, not by error.SHUTTING_DOWN
Indicates that JDA was shutdown and no further connections should be established
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldReconnect()
static ConnectionStatus
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConnectionStatus[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NOT_CONNECTED
public static final ConnectionStatus NOT_CONNECTED
Indicates that there is no open connection or that the connection was closed by choice, not by error.
-
SHUTTING_DOWN
public static final ConnectionStatus SHUTTING_DOWN
Indicates that JDA was shutdown and no further connections should be established
-
CONNECTING_AWAITING_ENDPOINT
public static final ConnectionStatus CONNECTING_AWAITING_ENDPOINT
JDA is waiting on Discord to send a valid endpoint which to connect the audio websocket to.
-
CONNECTING_AWAITING_WEBSOCKET_CONNECT
public static final ConnectionStatus CONNECTING_AWAITING_WEBSOCKET_CONNECT
JDA has received a valid endpoint and is attempting to setup and connect the audio websocket
-
CONNECTING_AWAITING_AUTHENTICATION
public static final ConnectionStatus CONNECTING_AWAITING_AUTHENTICATION
JDA has connected the audio websocket to Discord and has sent the authentication information, awaiting reply.
-
CONNECTING_ATTEMPTING_UDP_DISCOVERY
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.
-
CONNECTING_AWAITING_READY
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.
-
CONNECTED
public static final ConnectionStatus CONNECTED
The audio connection has been successfully setup and is ready for use.
-
DISCONNECTED_LOST_PERMISSION
public static final ConnectionStatus DISCONNECTED_LOST_PERMISSION
Indicates that the logged in account lost thePermission.VOICE_CONNECT
and cannot connect to the channel.
-
DISCONNECTED_CHANNEL_DELETED
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.
-
DISCONNECTED_REMOVED_FROM_GUILD
public static final ConnectionStatus DISCONNECTED_REMOVED_FROM_GUILD
Indicates that the logged in account was removed from theGuild
that this audio connection was connected to, thus the connection was severed.
-
DISCONNECTED_KICKED_FROM_CHANNEL
public static final ConnectionStatus DISCONNECTED_KICKED_FROM_CHANNEL
Indicates that we were kicked from a channel by a moderator
-
DISCONNECTED_REMOVED_DURING_RECONNECT
public static final ConnectionStatus DISCONNECTED_REMOVED_DURING_RECONNECT
Indicates that the logged in account was removed from theGuild
while reconnecting to the gateway
-
DISCONNECTED_AUTHENTICATION_FAILURE
public static final ConnectionStatus DISCONNECTED_AUTHENTICATION_FAILURE
Indicates that our token was not valid.
-
AUDIO_REGION_CHANGE
public static final ConnectionStatus AUDIO_REGION_CHANGE
Indicates that the audio connection was closed due to theRegion
of the audio connection being changed. JDA will automatically attempt to reconnect the audio connection regardless of the value of theAudioManager.isAutoReconnect()
.
-
ERROR_LOST_CONNECTION
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.
-
ERROR_CANNOT_RESUME
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.
-
ERROR_WEBSOCKET_UNABLE_TO_CONNECT
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.
-
ERROR_UNSUPPORTED_ENCRYPTION_MODES
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.
-
ERROR_UDP_UNABLE_TO_CONNECT
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.
-
ERROR_CONNECTION_TIMEOUT
public static final ConnectionStatus ERROR_CONNECTION_TIMEOUT
Occurs when it takes longer thanAudioManager.getConnectTimeout()
to establish the Websocket connection and setup the UDP connection.
JDA automatically attempts to reconnect when this error occurs.
-
-
Method Detail
-
values
public static ConnectionStatus[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConnectionStatus c : ConnectionStatus.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConnectionStatus valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
shouldReconnect
public boolean shouldReconnect()
-
-