- All Implemented Interfaces:
public enum WebSocketState extends java.lang.Enum<WebSocketState>WebSocket state.
Read included Apache License 2.0:
NeoVisionaries.WebSockets.*Code Obtained From:
GitHub 'NV' (Takahiko Kawasaki)Public Archive.
The initial state of a
connect()method is allowed to be called only when the state is
CREATED. If the method is called when the state is not
WebSocketExceptionis thrown (its error code is
After the state is changed to
CONNECTING, a WebSocket opening handshake is performed. If an error occurred during the handshake, the state is changed to
onStateChanged()method of listeners is called) and a
WebSocketExceptionis thrown. There are various reasons for handshake failure. If you want to know the reason, get the error code (
WebSocketError) by calling
getError()method of the exception.
After the opening handshake succeeded, the state is changed to
onConnected()method are called in this order. Note that
onConnected()method is called by another thread.
After the client and the server have exchanged close frames, the state is changed to
onDisconnected()method is called in this order.
Enum Constant Summary
Enum Constants Enum Constant Description
CLOSEDThe WebSocket connection is closed.
CLOSINGA closing handshake is being performed.
CONNECTINGAn opening handshake is being performed.
CREATEDThe initial state of a
OPENThe WebSocket connection is established (= the opening handshake has succeeded) and usable.
All Methods Static Methods Concrete Methods Modifier and Type Method Description
valueOf(String name)Returns the enum constant of this type with the specified name.
values()Returns an array containing the constants of this enum type, in the order they are declared.
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Enum Constant Detail
public static final WebSocketState OPENThe WebSocket connection is established (= the opening handshake has succeeded) and usable.
public static WebSocketState 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 (WebSocketState c : WebSocketState.values()) System.out.println(c);
- an array containing the constants of this enum type, in the order they are declared
public static WebSocketState 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.)
name- the name of the enum constant to be returned.
- the enum constant with the specified name
java.lang.IllegalArgumentException- if this enum type has no constant with the specified name
java.lang.NullPointerException- if the argument is null