Examveda
Examveda

What does the value 2 of the WebSocket attribute Socket.readyState indicate?

A. Closed connection

B. Handshake connection

C. Unestablished connection

D. Established connection and communication is possible

Answer: Option B

Solution(By Examveda Team)

The readonly attribute readyState represents the state of the connection. It can have the following values:
1. A value of 0 indicates that the connection has not yet been established.
2. A value of 1 indicates that the connection is established and communication is possible.
3. A value of 2 indicates that the connection is going through the closing handshake.
4. A value of 3 indicates that the connection has been closed or could not be opened.

Join The Discussion

Related Questions on Sockets