- From: Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
- Date: Thu, 23 Feb 2012 12:41:08 +0100
- To: Adam Bergkvist <adam.bergkvist@ericsson.com>
- Cc: "public-webrtc@w3.org" <public-webrtc@w3.org>
Hi Adam, I'm not familiar with JS, but I'm trying to understand how the suggested API maps to SCTP. Please see some questions/comments in-line. Best regards Michael On Feb 22, 2012, at 5:32 PM, Adam Bergkvist wrote: > Hi > > I got a task from the WebRTC chairs and editors to work some more with the Data API, taking Justins proposal as a starting point, meet what most people seem to want (http://lists.w3.org/Archives/Public/public-webrtc/2012Feb/0153.html) from the API and align with the Web Socket API as far as possible. Comments and feedback are greatly appreciated. > > A DataChannel object is bi-directional data channel that is decoupled from the MediaStream concept. I.e., there are no local or remote DataChannels since data can be written to, and read from the same object. When a DataChannel is created at one end of a PeerConnection, an event, with the corresponding DataChannel, is dispatched on the other end. There's no need to remove a DataChannel object from it's associated PeerConnection; the close() method disposes the channel similar to WebSocket. The DataChanelInit dictionary is used to configure a DataChannel at creation time; it will be extended as we expose more configuration possibilities. > > Some examples: > > // Simple example how to create a DataChannel, send and receive data. > > var chan = peerConn.createDataChannel("mylabel"); What is the usage of 'mylabel'. It doesn't seem to be used locally or remotely. I assume that you want to map channels to bi-directional streams, is this right? > > chan.onmessage = function (evt) { > // use evt.data > }; > > chan.send("hello"); > > ----- > > // Example of to handle the case when a remote peer creates a DataChannel > > peerConn.ondatachannel = function (evt) { > var chan = evt.channel; > > chan.onmessage = function (evt) { > // use evt.data > }; > > chan.onclose = function () { > // remote side closed the data channel > }; > }; > > ---- > > Below are the IDLs of this API. > > *** Changes to PeerConnection *** > > interface PeerConnection { > ... > > DataChannel createDataChannel(DOMString? label, optional DataChannelInit? dataChannelDict); > > attribute Function? ondatachannel; > ... > }; > > > *** DataChannel *** > > interface DataChannel { > readonly attribute DOMString label; What is the semantic of this? > > readonly attribute boolean reliable; This is a property of a user message, not of a stream. > readonly attribute long priority; This is a property of a stream. > // ... extend here ... > }; What about unordered? When do you expect a message to be abondoned when treated unreliable? > DataChannel implements AbstractMessenger; > > interface AbstractMessenger { > // ready state > const unsigned short CONNECTING = 0; > const unsigned short OPEN = 1; > const unsigned short CLOSING = 2; > const unsigned short CLOSED = 3; > readonly attribute unsigned short readyState; > readonly attribute unsigned long bufferedAmount; > > // networking > [TreatNonCallableAsNull] attribute Function? onopen; > [TreatNonCallableAsNull] attribute Function? onerror; > [TreatNonCallableAsNull] attribute Function? onclose; > void close([Clamp] optional unsigned short code, optional DOMString reason); > > // messaging > [TreatNonCallableAsNull] attribute Function? onmessage; > attribute DOMString binaryType; > void send(DOMString data); > void send(ArrayBuffer data); > void send(Blob data); > }; > > > *** Dictionaries and Events *** > > dictionary DataChannelInit { > boolean reliable; > long priority; > // ... extend here ... > }; > > [Constructor(DOMString type, optional DataChannelEventInit eventInitDict)] > interface DataChannelEvent : Event { > readonly attribute DataChannel? channel; > }; > > dictionary DataChannelEventInit : EventInit { > DataChannel? channel; > }; > > /Adam > >
Received on Thursday, 23 February 2012 11:41:39 UTC