[webrtc-pc] Copy/modify spec from WebSocket for RTCDataChannel's binaryType and onmessage

soareschen has just created a new issue for https://github.com/w3c/webrtc-pc:

== Copy/modify spec from WebSocket for RTCDataChannel's binaryType and onmessage ==
The API for data channel is slightly different from WebSocket. So it makes more sense to copy/modify the relevant steps instead of requiring to follow WebSocket. The reference to WebSocket sections should be informative instead.

For `binaryType`, the following paragraph should be copied:

> On setting, if the new value is either the string "blob" or the string "arraybuffer", then set the IDL attribute to this new value. Otherwise, throw a SyntaxError exception.

Alternatively, an enum could be defined for `binaryType` attribute.

For `onmessage`, detailed steps should be written that include the following steps copied from WebSocket:

- Let event be an event that uses the MessageEvent interface, with the event type message, which does not bubble, is not cancelable, and has no default action.
- If binaryType is set to "blob", then initialize event's data attribute to a new Blob object that represents data as its raw data. [FILEAPI]
- If binaryType is set to "arraybuffer", then initialize event's data attribute to a new read-only ArrayBuffer object whose contents are data. [TYPEDARRAY]

Note that unlike WebSocket, RTCDataChannel do not have the concept of frame type, and there is no text message. It is also not clear what should be the `origin` value for the `MessageEvent`.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1352 using your GitHub account

Received on Wednesday, 7 June 2017 07:49:39 UTC