diff options
Diffstat (limited to 'files/zh-cn/web/api/websocket/protocol')
-rw-r--r-- | files/zh-cn/web/api/websocket/protocol/index.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/websocket/protocol/index.html b/files/zh-cn/web/api/websocket/protocol/index.html new file mode 100644 index 0000000000..8a575f1180 --- /dev/null +++ b/files/zh-cn/web/api/websocket/protocol/index.html @@ -0,0 +1,41 @@ +--- +title: WebSocket.protocol +slug: Web/API/WebSocket/protocol +translation_of: Web/API/WebSocket/protocol +--- +<p>{{APIRef("Web Sockets API")}}</p> + +<p><strong><code>WebSocket.protocol</code></strong> 是个只读属性,用于返回服务器端选中的子协议的名字;这是一个在创建{{domxref("WebSocket")}} 对象时,在参数{{domxref("<code>protocols</code>")}}中指定的字符串,当没有已建立的链接时为空串。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox notranslate">var protocol = <em>aWebSocket</em>.protocol;</pre> + +<h2 id="返回值">返回值</h2> + +<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMString" title="DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String."><code>DOMString</code></a>.</p> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-websocket-protocol', 'WebSocket: protocol')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.WebSocket.protocol")}}</p> |