socket.readyState


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

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

  • 如果流正在连接,socket.readyState 的值是 opening
  • 如果这个流是可读可写的,它就是“打开”的。
  • 如果流是可读的而不可写的,它就是 readOnly
  • 如果流不可读且不可写,它就是 writeOnly