Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

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

  2. A.

     Closed connection

    B.

     Handshake connection

    C.

     Unestablished connection

    D.

     Established connection and communication is possible

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    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.


Be The First To Comment