socket.readyState


此属性将连接状态表示为字符串。

  • 如果流正在连接,则 socket.readyState 是 opening。
  • 如果流可读可写,则为 open。
  • 如果流可读不可写,则为 readOnly。
  • 如果流不可读写,则为 writeOnly。

This property represents the state of the connection as a string.

  • If the stream is connecting socket.readyState is opening.
  • If the stream is readable and writable, it is open.
  • If the stream is readable and not writable, it is readOnly.
  • If the stream is not readable and writable, it is writeOnly.