Enum WebSocketError
- java.lang.Object
-
- java.lang.Enum<WebSocketError>
-
- NeoVisionaries.WebSockets.WebSocketError
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<WebSocketError>
public enum WebSocketError extends java.lang.Enum<WebSocketError>
WebSocket error codes.
Read included Apache License 2.0:HERE
AllNeoVisionaries.WebSockets.*
Code Obtained From:GitHub 'NV' (Takahiko Kawasaki)
Public Archive.- See Also:
WebSocketException.getError()
Hi-Lited Source-Code:- View Here: NeoVisionaries/WebSockets/WebSocketError.java
- Open New Browser-Tab: NeoVisionaries/WebSockets/WebSocketError.java
File Size: 11,236 Bytes Line Count: 457 '\n' Characters Found
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COMPRESSION_ERROR
Compression failed.CONTINUATION_NOT_CLOSED
A non-control frame was detected although the existing continuation had not been closed.DECOMPRESSION_ERROR
Decompression failed.EXTENSION_PARSE_ERROR
The value inSec-WebSocket-Extensions
failed to be parsed.EXTENSIONS_CONFLICT
The combination of the extensions contained inSec-WebSocket-Extensions
header causes conflicts.FLUSH_ERROR
Flushing frames to the server failed.FRAGMENTED_CONTROL_FRAME
A control frame is fragmented.FRAME_MASKED
A frame from the server is masked.HOSTNAME_UNVERIFIED
The certificate of the peer does not match the expected hostname.HTTP_HEADER_FAILURE
An error occurred while HTTP header section was being read.INSUFFICENT_DATA
The end of the stream has been reached unexpectedly.INSUFFICIENT_MEMORY_FOR_PAYLOAD
OutOfMemoryError
occurred during a trial to allocate a memory area for a frame's payload.INTERRUPTED_IN_READING
Interruption occurred while a frame was being read from the WebSocket.INVALID_PAYLOAD_LENGTH
The payload length of a frame is invalid.IO_ERROR_IN_READING
An I/O error occurred while a frame was being read from the WebSocket.IO_ERROR_IN_WRITING
An I/O error occurred when a frame was tried to be sent.MESSAGE_CONSTRUCTION_ERROR
Failed to concatenate payloads of multiple frames to construct a message.NO_CONNECTION_HEADER
The opening handshake response does not containConnection
header.NO_MORE_FRAME
No more frame can be read because the end of the input stream has been reached.NO_SEC_WEBSOCKET_ACCEPT_HEADER
The opening handshake response does not containSec-WebSocket-Accept
header.NO_UPGRADE_HEADER
The opening handshake response does not containUpgrade
header.NO_UPGRADE_IN_CONNECTION_HEADER
Upgrade
was not found inConnection
header.NO_WEBSOCKET_IN_UPGRADE_HEADER
websocket
was not found inUpgrade
header.NON_ZERO_RESERVED_BITS
At least one of the reserved bits of a frame is set.NOT_IN_CREATED_STATE
The current state of the WebSocket is not CREATED.NOT_SWITCHING_PROTOCOLS
The status code of the opening handshake response is not101 Switching Protocols
.OPENING_HAHDSHAKE_REQUEST_FAILURE
Failed to send an opening handshake request to the server.OPENING_HANDSHAKE_RESPONSE_FAILURE
Failed to read an opening handshake response from the server.PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
The value ofserver_max_window_bits
parameter orclient_max_window_bits
parameter ofpermessage-deflate
extension is invalid.PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
permessage-deflate
extension contains an unsupported parameter.PROXY_HANDSHAKE_ERROR
Handshake with a proxy server failed.SOCKET_CONNECT_ERROR
Socket.connect()
failed.SOCKET_INPUT_STREAM_FAILURE
Failed to get the input stream of the raw socket.SOCKET_OUTPUT_STREAM_FAILURE
Failed to get the output stream of the raw socket.SOCKET_OVERLAY_ERROR
Failed to overlay an existing socket.SSL_HANDSHAKE_ERROR
SSL handshake with a WebSocket endpoint failed.STATUS_LINE_BAD_FORMAT
The status line of the opening handshake response is badly formatted.STATUS_LINE_EMPTY
The status line of the opening handshake response is empty.TEXT_MESSAGE_CONSTRUCTION_ERROR
Failed to convert payload data into a string.TOO_LONG_CONTROL_FRAME_PAYLOAD
The payload size of a control frame exceeds the maximum size (125 bytes).TOO_LONG_PAYLOAD
The payload length of a frame exceeds the maximum array size in Java.UNEXPECTED_CONTINUATION_FRAME
A continuation frame was detected although a continuation had not started.UNEXPECTED_ERROR_IN_READING_THREAD
An uncaught throwable was detected in the reading thread (which reads frames from the server).UNEXPECTED_ERROR_IN_WRITING_THREAD
An uncaught throwable was detected in the writing thread (which sends frames to the server).UNEXPECTED_RESERVED_BIT
A reserved bit of a frame has an unexpected value.UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
The value ofSec-WebSocket-Accept
header is different from the expected one.UNKNOWN_OPCODE
A frame has an unknown opcode.UNSUPPORTED_EXTENSION
The extension contained inSec-WebSocket-Extensions
header is not supported.UNSUPPORTED_PROTOCOL
The protocol contained inSec-WebSocket-Protocol
header is not supported.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WebSocketError
valueOf(String name)
Returns the enum constant of this type with the specified name.static WebSocketError[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NOT_IN_CREATED_STATE
public static final WebSocketError NOT_IN_CREATED_STATE
The current state of the WebSocket is not CREATED.This error occurs if
WebSocket.connect()
is called when the state of the WebSocket is notCREATED
.
-
SOCKET_INPUT_STREAM_FAILURE
public static final WebSocketError SOCKET_INPUT_STREAM_FAILURE
Failed to get the input stream of the raw socket.
-
SOCKET_OUTPUT_STREAM_FAILURE
public static final WebSocketError SOCKET_OUTPUT_STREAM_FAILURE
Failed to get the output stream of the raw socket.
-
OPENING_HAHDSHAKE_REQUEST_FAILURE
public static final WebSocketError OPENING_HAHDSHAKE_REQUEST_FAILURE
Failed to send an opening handshake request to the server.
-
OPENING_HANDSHAKE_RESPONSE_FAILURE
public static final WebSocketError OPENING_HANDSHAKE_RESPONSE_FAILURE
Failed to read an opening handshake response from the server.
-
STATUS_LINE_EMPTY
public static final WebSocketError STATUS_LINE_EMPTY
The status line of the opening handshake response is empty.
-
STATUS_LINE_BAD_FORMAT
public static final WebSocketError STATUS_LINE_BAD_FORMAT
The status line of the opening handshake response is badly formatted.
-
NOT_SWITCHING_PROTOCOLS
public static final WebSocketError NOT_SWITCHING_PROTOCOLS
The status code of the opening handshake response is not101 Switching Protocols
.
-
HTTP_HEADER_FAILURE
public static final WebSocketError HTTP_HEADER_FAILURE
An error occurred while HTTP header section was being read.
-
NO_UPGRADE_HEADER
public static final WebSocketError NO_UPGRADE_HEADER
The opening handshake response does not containUpgrade
header.
-
NO_WEBSOCKET_IN_UPGRADE_HEADER
public static final WebSocketError NO_WEBSOCKET_IN_UPGRADE_HEADER
websocket
was not found inUpgrade
header.
-
NO_CONNECTION_HEADER
public static final WebSocketError NO_CONNECTION_HEADER
The opening handshake response does not containConnection
header.
-
NO_UPGRADE_IN_CONNECTION_HEADER
public static final WebSocketError NO_UPGRADE_IN_CONNECTION_HEADER
Upgrade
was not found inConnection
header.
-
NO_SEC_WEBSOCKET_ACCEPT_HEADER
public static final WebSocketError NO_SEC_WEBSOCKET_ACCEPT_HEADER
The opening handshake response does not containSec-WebSocket-Accept
header.
-
UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
public static final WebSocketError UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
The value ofSec-WebSocket-Accept
header is different from the expected one.
-
EXTENSION_PARSE_ERROR
public static final WebSocketError EXTENSION_PARSE_ERROR
The value inSec-WebSocket-Extensions
failed to be parsed.
-
UNSUPPORTED_EXTENSION
public static final WebSocketError UNSUPPORTED_EXTENSION
The extension contained inSec-WebSocket-Extensions
header is not supported.
-
EXTENSIONS_CONFLICT
public static final WebSocketError EXTENSIONS_CONFLICT
The combination of the extensions contained inSec-WebSocket-Extensions
header causes conflicts.- Since:
- 1.15
-
UNSUPPORTED_PROTOCOL
public static final WebSocketError UNSUPPORTED_PROTOCOL
The protocol contained inSec-WebSocket-Protocol
header is not supported.
-
INSUFFICENT_DATA
public static final WebSocketError INSUFFICENT_DATA
The end of the stream has been reached unexpectedly.
-
INVALID_PAYLOAD_LENGTH
public static final WebSocketError INVALID_PAYLOAD_LENGTH
The payload length of a frame is invalid.
-
TOO_LONG_PAYLOAD
public static final WebSocketError TOO_LONG_PAYLOAD
The payload length of a frame exceeds the maximum array size in Java.
-
INSUFFICIENT_MEMORY_FOR_PAYLOAD
public static final WebSocketError INSUFFICIENT_MEMORY_FOR_PAYLOAD
OutOfMemoryError
occurred during a trial to allocate a memory area for a frame's payload.
-
INTERRUPTED_IN_READING
public static final WebSocketError INTERRUPTED_IN_READING
Interruption occurred while a frame was being read from the WebSocket.
-
IO_ERROR_IN_READING
public static final WebSocketError IO_ERROR_IN_READING
An I/O error occurred while a frame was being read from the WebSocket.
-
IO_ERROR_IN_WRITING
public static final WebSocketError IO_ERROR_IN_WRITING
An I/O error occurred when a frame was tried to be sent.
-
FLUSH_ERROR
public static final WebSocketError FLUSH_ERROR
Flushing frames to the server failed.
-
NON_ZERO_RESERVED_BITS
public static final WebSocketError NON_ZERO_RESERVED_BITS
At least one of the reserved bits of a frame is set.From RFC 6455, 5.2 Base Framing Protocol; RSV1, RSV2, RSV3:
MUST be 0 unless an extension is negotiated that defines meanings for non-zero values. If a nonzero value is received and none of the negotiated extensions defines the meaning of such a nonzero value, the receiving endpoint MUST Fail the WebSocket Connection.
By calling
WebSocket.setExtended
(true)
, you can skip the validity check of the RSV1/RSV2/RSV3 bits.This error code is not used in version 1.15 and after.
-
UNEXPECTED_RESERVED_BIT
public static final WebSocketError UNEXPECTED_RESERVED_BIT
A reserved bit of a frame has an unexpected value.From RFC 6455, 5.2 Base Framing Protocol; RSV1, RSV2, RSV3:
MUST be 0 unless an extension is negotiated that defines meanings for non-zero values. If a nonzero value is received and none of the negotiated extensions defines the meaning of such a nonzero value, the receiving endpoint MUST Fail the WebSocket Connection.
By calling
WebSocket.setExtended
(true)
, you can skip the validity check of the RSV1/RSV2/RSV3 bits.- Since:
- 1.15
-
FRAME_MASKED
public static final WebSocketError FRAME_MASKED
A frame from the server is masked.From RFC 6455, 5.1. Overview:
A server MUST NOT mask any frames that it sends to the client. A client MUST close a connection if it detects a masked frame.
-
UNKNOWN_OPCODE
public static final WebSocketError UNKNOWN_OPCODE
A frame has an unknown opcode.By calling
WebSocket.setExtended
(true)
, you can accept frames which have an unknown opcode.
-
FRAGMENTED_CONTROL_FRAME
public static final WebSocketError FRAGMENTED_CONTROL_FRAME
A control frame is fragmented.From RFC 6455, 5.4. Fragmentation:
Control frames (see Section 5.5) MAY be injected in the middle of a fragmented message. Control frames themselves MUST NOT be fragmented.
-
UNEXPECTED_CONTINUATION_FRAME
public static final WebSocketError UNEXPECTED_CONTINUATION_FRAME
A continuation frame was detected although a continuation had not started.
-
CONTINUATION_NOT_CLOSED
public static final WebSocketError CONTINUATION_NOT_CLOSED
A non-control frame was detected although the existing continuation had not been closed.
-
TOO_LONG_CONTROL_FRAME_PAYLOAD
public static final WebSocketError TOO_LONG_CONTROL_FRAME_PAYLOAD
The payload size of a control frame exceeds the maximum size (125 bytes).From RFC 6455, 5.5. Control Frames:
All control frames MUST have a payload length of 125 bytes or less and MUST NOT be fragmented.
-
MESSAGE_CONSTRUCTION_ERROR
public static final WebSocketError MESSAGE_CONSTRUCTION_ERROR
Failed to concatenate payloads of multiple frames to construct a message.
-
TEXT_MESSAGE_CONSTRUCTION_ERROR
public static final WebSocketError TEXT_MESSAGE_CONSTRUCTION_ERROR
Failed to convert payload data into a string.
-
UNEXPECTED_ERROR_IN_READING_THREAD
public static final WebSocketError UNEXPECTED_ERROR_IN_READING_THREAD
An uncaught throwable was detected in the reading thread (which reads frames from the server).
-
UNEXPECTED_ERROR_IN_WRITING_THREAD
public static final WebSocketError UNEXPECTED_ERROR_IN_WRITING_THREAD
An uncaught throwable was detected in the writing thread (which sends frames to the server).
-
PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
public static final WebSocketError PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
permessage-deflate
extension contains an unsupported parameter.See 7. The "permessage-deflate" Extension in RFC 7692 for details.
- Since:
- 1.15
-
PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
public static final WebSocketError PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
The value ofserver_max_window_bits
parameter orclient_max_window_bits
parameter ofpermessage-deflate
extension is invalid.See 7.1.2. Limiting the LZ77 Sliding Window Size in RFC 7692 for details.
- Since:
- 1.15
-
COMPRESSION_ERROR
public static final WebSocketError COMPRESSION_ERROR
Compression failed.- Since:
- 1.17
-
DECOMPRESSION_ERROR
public static final WebSocketError DECOMPRESSION_ERROR
Decompression failed.- Since:
- 1.16
-
SOCKET_CONNECT_ERROR
public static final WebSocketError SOCKET_CONNECT_ERROR
Socket.connect()
failed.- Since:
- 1.20
-
PROXY_HANDSHAKE_ERROR
public static final WebSocketError PROXY_HANDSHAKE_ERROR
Handshake with a proxy server failed.- Since:
- 1.20
-
SOCKET_OVERLAY_ERROR
public static final WebSocketError SOCKET_OVERLAY_ERROR
Failed to overlay an existing socket.- Since:
- 1.20
-
SSL_HANDSHAKE_ERROR
public static final WebSocketError SSL_HANDSHAKE_ERROR
SSL handshake with a WebSocket endpoint failed.- Since:
- 1.20
-
NO_MORE_FRAME
public static final WebSocketError NO_MORE_FRAME
No more frame can be read because the end of the input stream has been reached.This happens when the WebSocket connection is closed without receiving a close frame from the WebSocket server. Strictly speaking, it is a violation against RFC 6455, but it seems some server implementations sometimes close a connection without sending a close frame.
- Since:
- 1.29
-
HOSTNAME_UNVERIFIED
public static final WebSocketError HOSTNAME_UNVERIFIED
The certificate of the peer does not match the expected hostname.When
WebSocketException.getError()
returns this error code, theWebSocketException
can be cast toHostnameUnverifiedException
through which you can get theSee Verify that certificate is valid for server hostname (#107).
- Since:
- 2.1
-
-
Method Detail
-
values
public static WebSocketError[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (WebSocketError c : WebSocketError.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static WebSocketError valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-