Class CloseStatus

java.lang.Object
discord4j.common.close.CloseStatus

public class CloseStatus extends Object
Container for WebSocket "close" status codes and reasons.
See Also:
  • Field Details

    • NORMAL_CLOSE

      public static final CloseStatus NORMAL_CLOSE
    • ABNORMAL_CLOSE

      public static final CloseStatus ABNORMAL_CLOSE
  • Constructor Details

    • CloseStatus

      public CloseStatus(int code, @Nullable String reason)
      Create a new CloseStatus instance.
      Parameters:
      code - the status code
      reason - the reason
  • Method Details

    • getCode

      public int getCode()
      Return the websocket close code.
      Returns:
      a websocket close code
    • getReason

      public Optional<String> getReason()
      Return a websocket close reason, if present.
      Returns:
      an Optional containing a close reason if present, or empty otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object