WebSocket.readyState

概要

返回当前 WebSocket 的链接状态,只读。

语法

var readyState = aWebSocket.readyState;

以下其中之一

0 (CONNECTING)
正在链接中
1 (OPEN)
已经链接并且可以通讯
2 (CLOSING)
连接正在关闭
3 (CLOSED)
连接已关闭或者没有链接成功

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'WebSocket.readyState' in that specification.
Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge ? Firefox Full support YesIE ? Opera Full support YesSafari ? WebView Android ? Chrome Android Full support YesEdge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

标签: 
此页面的贡献者: rguanghui
最后编辑者: rguanghui,