| Modifier and Type | Field and Description |
|---|---|
| public static final int | ABNORMAL_CLOSE
1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. |
| public static final int | BAD_GATEWAY
1014 indicates that the server was acting as a gateway or proxy and received an invalid response from the upstream server. |
| public static final int | BUGGYCLOSE
The connection had a buggy close (this should not happen) |
| private int | code
The close code used in this close frame |
| public static final int | 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. |
| public static final int | FLASHPOLICY
The connection was flushed and closed |
| public static final int | 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. |
| public static final int | NEVER_CONNECTED
The connection had never been established |
| public static final int | NO_UTF8
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). |
| public static final int | NOCODE
1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. |
| public static final int | NORMAL
indicates a normal closure, meaning whatever purpose the connection was established for has been fulfilled. |
| public static final int | POLICY_VALIDATION
1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. |
| public static final int | PROTOCOL_ERROR
1002 indicates that an endpoint is terminating the connection due to a protocol error. |
| private String | reason
The close message used in this close frame |
| public static final int | REFUSE
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). |
| public static final int | SERVICE_RESTART
1012 indicates that the service is restarted. |
| public static final int | TLS_ERROR
1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. |
| public static final int | TOOBIG
1009 indicates that an endpoint is terminating the connection because it has received a message which is too big for it to process. |
| public static final int | TRY_AGAIN_LATER
1013 indicates that the service is experiencing overload. |
| public static final int | UNEXPECTED_CONDITION
1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object o)
Overrides org. Indicates whether some other object is "equal to" this one. |
| public int | |
| public String | |
| public ByteBuffer | getPayloadData()
Overrides org. Implements org. The "Payload data" which was sent in this frame |
| public int | hashCode()
Overrides org. Returns a hash code value for this object. |
| public void | isValid()
Overrides org. Check if the frame is valid due to specification |
| public void | |
| public void | setPayload(ByteBuffer payload)
Overrides org. Set the payload of this frame to the provided payload |
| public void | |
| public String | toString()
Overrides org. Returns a string representation of the object. |
| private void | |
| private void | validateUtf8(ByteBuffer
the current payload payload, int the current mark mark)Validate the payload to valid utf8 |
| ABNORMAL_CLOSE | back to summary |
|---|---|
| public static final int ABNORMAL_CLOSE 1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally, e.g. without sending or receiving a Close control frame. | |
| BAD_GATEWAY | back to summary |
|---|---|
| public static final int BAD_GATEWAY 1014 indicates that the server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code See https://www.ietf.org/mail-archive/web/hybi/current/msg10748.html fore more information.
| |
| BUGGYCLOSE | back to summary |
|---|---|
| public static final int BUGGYCLOSE The connection had a buggy close (this should not happen) | |
| code | back to summary |
|---|---|
| private int code The close code used in this close frame | |
| EXTENSION | back to summary |
|---|---|
| public static final int 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 which 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. | |
| FLASHPOLICY | back to summary |
|---|---|
| public static final int FLASHPOLICY The connection was flushed and closed | |
| GOING_AWAY | back to summary |
|---|---|
| public static final int 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. | |
| NEVER_CONNECTED | back to summary |
|---|---|
| public static final int NEVER_CONNECTED The connection had never been established | |
| NO_UTF8 | back to summary |
|---|---|
| public static final int NO_UTF8 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). | |
| NOCODE | back to summary |
|---|---|
| public static final int NOCODE 1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that no status code was actually present. | |
| NORMAL | back to summary |
|---|---|
| public static final int NORMAL indicates a normal closure, meaning whatever purpose the connection was established for has been fulfilled. | |
| POLICY_VALIDATION | back to summary |
|---|---|
| public static final int POLICY_VALIDATION 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. | |
| PROTOCOL_ERROR | back to summary |
|---|---|
| public static final int PROTOCOL_ERROR 1002 indicates that an endpoint is terminating the connection due to a protocol error. | |
| reason | back to summary |
|---|---|
| private String reason The close message used in this close frame | |
| REFUSE | back to summary |
|---|---|
| public static final int REFUSE 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). | |
| SERVICE_RESTART | back to summary |
|---|---|
| public static final int SERVICE_RESTART 1012 indicates that the service is restarted. A client may reconnect, and if it choses to do, should reconnect using a randomized delay of 5 - 30s. See https://www.ietf.org/mail-archive/web/hybi/current/msg09670.html for more information.
| |
| TLS_ERROR | back to summary |
|---|---|
| public static final int TLS_ERROR 1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified). | |
| TOOBIG | back to summary |
|---|---|
| public static final int TOOBIG 1009 indicates that an endpoint is terminating the connection because it has received a message which is too big for it to process. | |
| TRY_AGAIN_LATER | back to summary |
|---|---|
| public static final int TRY_AGAIN_LATER 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 https://www.ietf.org/mail-archive/web/hybi/current/msg09670.html for more information.
| |
| UNEXPECTED_CONDITION | back to summary |
|---|---|
| public static final int UNEXPECTED_CONDITION 1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. | |
| CloseFrame | back to summary |
|---|---|
| public CloseFrame() Constructor for a close frame Using opcode closing and fin = true | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides org. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| getCloseCode | back to summary |
|---|---|
| public int getCloseCode() Get the used close code
| |
| getMessage | back to summary |
|---|---|
| public String getMessage() Get the message that closeframe is containing
| |
| getPayloadData | back to summary |
|---|---|
| public ByteBuffer getPayloadData() Overrides org. Implements org. Doc from org. The "Payload data" which was sent in this frame
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isValid | back to summary |
|---|---|
| public void isValid() throws InvalidDataException Overrides org. Doc from org. Check if the frame is valid due to specification
| |
| setCode | back to summary |
|---|---|
| public void setCode(int code) Set the close code for this close frame
| |
| setPayload | back to summary |
|---|---|
| public void setPayload(ByteBuffer payload) Overrides org. Doc from org. Set the payload of this frame to the provided payload
| |
| setReason | back to summary |
|---|---|
| public void setReason(String reason) Set the close reason for this close frame
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| updatePayload | back to summary |
|---|---|
| private void updatePayload() Update the payload to represent the close code and the reason | |
| validateUtf8 | back to summary |
|---|---|
| private void validateUtf8(ByteBuffer payload, int mark) throws InvalidDataException Validate the payload to valid utf8
| |