Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy/modify spec from WebSocket for RTCDataChannel's binaryType and onmessage #1352

Closed
soareschen opened this issue Jun 7, 2017 · 1 comment

Comments

@soareschen
Copy link
Contributor

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.

@soareschen
Copy link
Contributor Author

Sorry, I missed it again. Apparently section 6.6 of rtcweb-data-channel defines both string and binary message type within SCTP.

I still think the spec could explain better some of the aspects of data channel messaging. Will raise them in separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant