public enum WebSocketState
- Object
- Enum<WebSocketState>
- WebSocketState
ImplementsComparable<WebSocketState>
Lifecycle state of a
WebSocket. The ordinal values match the browser
WebSocket spec and java.net.http.WebSocket so platform implementations
can map their native state directly.Enum constants
CONNECTING | The connection is being negotiated. |
OPEN | The handshake completed and the connection is live. |
CLOSING | A close has been initiated (locally or by the peer); the connection is draining final frames. |
CLOSED | The connection is fully closed and cannot be reopened. |
Methods
public static WebSocketState[] values() | |
public static WebSocketState valueOf(String name) |
Inherited methods
Enum constant details
CONNECTING
CONNECTINGThe connection is being negotiated. Sending messages in this state
throws
IllegalStateException.OPEN
OPENThe handshake completed and the connection is live. Messages can flow
in both directions.
CLOSING
CLOSINGA close has been initiated (locally or by the peer); the connection
is draining final frames.
CLOSED
CLOSEDThe connection is fully closed and cannot be reopened. Build a new
WebSocket to reconnect.Method details
values
public static WebSocketState[] values()valueOf
public static WebSocketState valueOf(String name)