public class DisconnectEvent extends Event
JDABuilder.setAutoReconnect(Boolean)
has been provided false
or the disconnect was too fatal.
When reconnecting was successful either a ReconnectEvent
or a ResumedEvent
is fired.
Constructor | Description |
---|---|
DisconnectEvent(JDA api,
com.neovisionaries.ws.client.WebSocketFrame serverCloseFrame,
com.neovisionaries.ws.client.WebSocketFrame clientCloseFrame,
boolean closedByServer,
java.time.OffsetDateTime disconnectTime) |
Modifier and Type | Method | Description |
---|---|---|
com.neovisionaries.ws.client.WebSocketFrame |
getClientCloseFrame() |
The close frame we sent to discord
|
CloseCode |
getCloseCode() |
Possibly-null
CloseCode
representing the meaning for this DisconnectEvent |
java.util.List<java.lang.String> |
getCloudflareRays() |
Contains all
cf-ray headers that JDA received in this session. |
java.time.OffsetDateTime |
getDisconnectTime() |
Time at which we noticed the disconnection
|
com.neovisionaries.ws.client.WebSocketFrame |
getServiceCloseFrame() |
The close frame discord sent to us
|
boolean |
isClosedByServer() |
Whether the connection was closed by discord
|
getJDA, getResponseNumber
public DisconnectEvent(JDA api, com.neovisionaries.ws.client.WebSocketFrame serverCloseFrame, com.neovisionaries.ws.client.WebSocketFrame clientCloseFrame, boolean closedByServer, java.time.OffsetDateTime disconnectTime)
public CloseCode getCloseCode()
CloseCode
representing the meaning for this DisconnectEvent
This is null
if this disconnect did either not happen because the Service closed the session
(see isClosedByServer()
) or if there is no mapped CloseCode enum constant for the service close code!
CloseCode
public java.util.List<java.lang.String> getCloudflareRays()
cf-ray
headers that JDA received in this session.
This is useful to monitor cloudflare activity from the Discord Developer perspective.
Use this list to report connection issues.
public com.neovisionaries.ws.client.WebSocketFrame getServiceCloseFrame()
WebSocketFrame
discord sent as closing handshakepublic com.neovisionaries.ws.client.WebSocketFrame getClientCloseFrame()
WebSocketFrame
we sent as closing handshakepublic boolean isClosedByServer()
public java.time.OffsetDateTime getDisconnectTime()