Class DisconnectEvent

    • Constructor Detail

      • DisconnectEvent

        public DisconnectEvent​(@Nonnull
                               JDA api,
                               @Nullable
                               WebSocketFrame serverCloseFrame,
                               @Nullable
                               WebSocketFrame clientCloseFrame,
                               boolean closedByServer,
                               @Nonnull
                               java.time.OffsetDateTime disconnectTime)
    • Method Detail

      • 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!

        Returns:
        Possibly-null CloseCode
      • getServiceCloseFrame

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

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

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

        @Nonnull
        public java.time.OffsetDateTime getTimeDisconnected()
        Time at which we noticed the disconnection
        Returns:
        Time of closure