Package ej.websocket
Enum ConnectionStates
- java.lang.Object
-
- java.lang.Enum<ConnectionStates>
-
- ej.websocket.ConnectionStates
-
- All Implemented Interfaces:
Serializable,Comparable<ConnectionStates>
public enum ConnectionStates extends Enum<ConnectionStates>
RFC6455 defined several possible states for a websocket. This enum type offer a Java representation for these states.This enum type add a additional state,
NEW. It indicate that the Websocket object has been created but theWebSocket.connect()method has not been already called. Hence, theWebSocketis not yet in theCONNECTINGstate.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CLOSEDState once the underlying TCP connection is closed.CLOSINGState "upon either sending or receiving a Close control frame".CONNECTINGInitial state of the websocket in the RFC6455.NEWTheWebSocketJava object has been created but itsWebSocket.connect()method has not been called yet.OPENState once the opening handshake is done.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConnectionStatesvalueOf(String name)Returns the enum constant of this type with the specified name.static ConnectionStates[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NEW
public static final ConnectionStates NEW
TheWebSocketJava object has been created but itsWebSocket.connect()method has not been called yet.
-
CONNECTING
public static final ConnectionStates CONNECTING
Initial state of the websocket in the RFC6455. The application is "establishing a websocket connection". It Java, the websocket moves to this sate when theWebSocket.connect()method is called.See section 4.1. Client Requirements.
-
OPEN
public static final ConnectionStates OPEN
State once the opening handshake is done.See end of section 4.1. Client Requirements.
-
CLOSING
public static final ConnectionStates CLOSING
State "upon either sending or receiving a Close control frame".See section 7.1.3. The WebSocket Closing Handshake is Started.
-
CLOSED
public static final ConnectionStates CLOSED
State once the underlying TCP connection is closed.See section 7.1.4. The WebSocket Connection is Closed.
-
-
Method Detail
-
values
public static ConnectionStates[] 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 (ConnectionStates c : ConnectionStates.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConnectionStates valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
-