Reputation: 991
WebSocket.readyState
can be CONNECTING
, OPEN
, CLOSING
or CLOSED
. What is the difference between CLOSING
and CLOSED
states? Why is it useful to distinguish between these two states? Can I treat a CLOSING
websocket the same as a CLOSED
websocket?
Upvotes: 0
Views: 389
Reputation: 597285
In the CLOSING
state, the WebSocket has sent a Close packet to the peer indicating that the connection is being intentionally ended and why, and is awaiting a reply from the peer. The TCP connection is still open at this stage.
In the CLOSED
state, the TCP connection has been closed, or was not successfully opened to begin with.
Upvotes: 1