Class SessionDisconnectEvent

All Implemented Interfaces:

public class SessionDisconnectEvent extends GenericSessionEvent
Indicates that JDA has been disconnected from the remote server.
When this event is fired JDA will try to reconnect if possible unless JDABuilder.setAutoReconnect(Boolean) has been provided false or the disconnect was too fatal in which case a ShutdownEvent is fired.

When reconnecting was successful either a SessionRecreateEvent or SessionResumeEvent is fired.

  • Constructor Details

  • Method Details

    • getCloseCode

      @Nullable public CloseCode getCloseCode()
      Possibly-null 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!

      Possibly-null CloseCode
    • getServiceCloseFrame

      @Nullable public WebSocketFrame getServiceCloseFrame()
      The close frame discord sent to us
      The WebSocketFrame discord sent as closing handshake
    • getClientCloseFrame

      @Nullable public WebSocketFrame getClientCloseFrame()
      The close frame we sent to discord
      The WebSocketFrame we sent as closing handshake
    • isClosedByServer

      public boolean isClosedByServer()
      Whether the connection was closed by discord
      True, if discord closed our connection
    • getTimeDisconnected

      @Nonnull public OffsetDateTime getTimeDisconnected()
      Time at which we noticed the disconnection
      Time of closure