WebSocket.protocol

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

WebSocket.protocol 是个只读属性,用于返回服务器端选中的子协议的名字;这是一个在创建 WebSocket 对象时,在参数 protocols 中指定的字符串,当没有已建立的链接时为空串。

语法

var protocol = aWebSocket.protocol;

返回值

规范

Specification
WebSockets Standard
# ref-for-dom-websocket-protocol①

浏览器兼容性

BCD tables only load in the browser