Module io.jooby
Package io.jooby

Class WebSocketCloseStatus

java.lang.Object
io.jooby.WebSocketCloseStatus

public class WebSocketCloseStatus extends Object
Collection of websocket close status.
Since:
2.2.0
Author:
edgar
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
    static final int
    1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
    1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
    static final int
    1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
    1006 indicates that an endpoint is terminating the connection.
    static final int
    1006 indicates that an endpoint is terminating the connection.
    1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
    static final int
    1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
    1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
    static final int
    1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
    1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy.
    static final int
    1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy.
    1002 indicates that an endpoint is terminating the connection due to a protocol error.
    static final int
    1002 indicates that an endpoint is terminating the connection due to a protocol error.
    1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake.
    static final int
    1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake.
    1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
    static final int
    1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
    1013 indicates that the service is experiencing overload.
    static final int
    1013 indicates that the service is experiencing overload.
    1012 indicates that the service is restarted.
    static final int
    1012 indicates that the service is restarted.
    1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
    static final int
    1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WebSocketCloseStatus(int code, String reason)
    Creates a new websocket close status.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Status code.
    Reason or null.
     
    valueOf(int code)
    Map the status code to one of the existing web socket status.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • NORMAL_CODE

      public static final int NORMAL_CODE
      1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
      See Also:
    • GOING_AWAY_CODE

      public static final int GOING_AWAY_CODE
      1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
      See Also:
    • PROTOCOL_ERROR_CODE

      public static final int PROTOCOL_ERROR_CODE
      1002 indicates that an endpoint is terminating the connection due to a protocol error.
      See Also:
    • NOT_ACCEPTABLE_CODE

      public static final int NOT_ACCEPTABLE_CODE
      1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
      See Also:
    • HARSH_DISCONNECT_CODE

      public static final int HARSH_DISCONNECT_CODE
      1006 indicates that an endpoint is terminating the connection.
      See Also:
    • BAD_DATA_CODE

      public static final int BAD_DATA_CODE
      1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
      See Also:
    • POLICY_VIOLATION_CODE

      public static final int POLICY_VIOLATION_CODE
      1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
      See Also:
    • TOO_BIG_TO_PROCESS_CODE

      public static final int TOO_BIG_TO_PROCESS_CODE
      1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
      See Also:
    • REQUIRED_EXTENSION_CODE

      public static final int REQUIRED_EXTENSION_CODE
      1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
      See Also:
    • SERVER_ERROR_CODE

      public static final int SERVER_ERROR_CODE
      1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
      See Also:
    • SERVICE_RESTARTED_CODE

      public static final int SERVICE_RESTARTED_CODE
      1012 indicates that the service is restarted. A client may reconnect, and if it chooses to do, should reconnect using a randomized delay of 5 - 30s.
      See Also:
    • SERVICE_OVERLOAD_CODE

      public static final int SERVICE_OVERLOAD_CODE
      1013 indicates that the service is experiencing overload. A client should only connect to a different IP (when there are multiple for the target) or reconnect to the same IP upon user action.
      See Also:
    • NORMAL

      public static final WebSocketCloseStatus NORMAL
      1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
    • GOING_AWAY

      public static final WebSocketCloseStatus GOING_AWAY
      1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
    • PROTOCOL_ERROR

      public static final WebSocketCloseStatus PROTOCOL_ERROR
      1002 indicates that an endpoint is terminating the connection due to a protocol error.
    • NOT_ACCEPTABLE

      public static final WebSocketCloseStatus NOT_ACCEPTABLE
      1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
    • HARSH_DISCONNECT

      public static final WebSocketCloseStatus HARSH_DISCONNECT
      1006 indicates that an endpoint is terminating the connection.
    • BAD_DATA

      public static final WebSocketCloseStatus BAD_DATA
      1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
    • POLICY_VIOLATION

      public static final WebSocketCloseStatus POLICY_VIOLATION
      1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
    • TOO_BIG_TO_PROCESS

      public static final WebSocketCloseStatus TOO_BIG_TO_PROCESS
      1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
    • REQUIRED_EXTENSION

      public static final WebSocketCloseStatus REQUIRED_EXTENSION
      1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
    • SERVER_ERROR

      public static final WebSocketCloseStatus SERVER_ERROR
      1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
    • SERVICE_RESTARTED

      public static final WebSocketCloseStatus SERVICE_RESTARTED
      1012 indicates that the service is restarted. A client may reconnect, and if it chooses to do, should reconnect using a randomized delay of 5 - 30s.
    • SERVICE_OVERLOAD

      public static final WebSocketCloseStatus SERVICE_OVERLOAD
      1013 indicates that the service is experiencing overload. A client should only connect to a different IP (when there are multiple for the target) or reconnect to the same IP upon user action.
  • Constructor Details

    • WebSocketCloseStatus

      public WebSocketCloseStatus(int code, @Nullable String reason)
      Creates a new websocket close status.
      Parameters:
      code - Status code.
      reason - Reason.
  • Method Details

    • getCode

      public int getCode()
      Status code.
      Returns:
      Status code.
    • getReason

      @Nullable public String getReason()
      Reason or null.
      Returns:
      Reason or null.
    • valueOf

      public static Optional<WebSocketCloseStatus> valueOf(int code)
      Map the status code to one of the existing web socket status.
      Parameters:
      code - Status code.
      Returns:
      Web socket status or empty.
    • toString

      public String toString()
      Overrides:
      toString in class Object