WebSocket.binaryType

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.binaryType 返回 websocket 连接所传输二进制数据的类型。

语法

var binaryType = aWebSocket.binaryType;

返回值

一条DOMString:

"blob"

如果传输的是 Blob 类型的数据。

"arraybuffer"

如果传输的是 ArrayBuffer 类型的数据。

规范

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

浏览器兼容性

BCD tables only load in the browser