首页 > 编程知识 正文

websocket怎么使用,websocket详解

时间:2023-05-04 00:45:40 阅读:50612 作者:4664

web套接字属性readyState webSocket的readyState属性用来定义连接状态,该属性的值有下面几种:

0 :支持常数连接(numeric value0),

正在建立连接。 还没有完成。 theconnectionhasnotyetbeenestablished。

1 :对应常数open(numericvalue1),

连接正常建立,可以进行通信。 thewebsocketconnectionisestablishedandcommunicationispossible。

2 :支持常数closing(numericvalue2)

连接是闭合的握手。 马上就要关闭了。 theconnectionisgoingthroughtheclosinghandshake。

3支持3 :常数关闭(numeric value3)

连接已关闭或根本没有建立。 theconnectionhasbeenclosedorcouldnotbeopened。

转自: https://www.cn blogs.com/Scott-j/p/9306197.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。