W3C home > Mailing lists > Public > public-webrtc@w3.org > September 2011

PeerConnection Data Channel

From: Justin Uberti <juberti@google.com>
Date: Fri, 2 Sep 2011 12:52:50 -0400
Message-ID: <CAOJ7v-1xEEA3+AX0hN4kR=9YggX7EW=wr4b67ASjibG_T=m2mQ@mail.gmail.com>
To: public-webrtc@w3.org
Section 5 in the WEBRTC spec (
http://dev.w3.org/2011/webrtc/editor/webrtc.html) discusses at length a
mechanism for transmitting and securing datagrams over the PeerConnection
transport. At both an API and a wire level, this mechanism is quite
different from the existing mechanisms that are used for transmission of
audio and video data:
- The availability of the data stream is not easily known, whereas
audio/video can be negotiated and stream existence learned from the *Stream
- It defines its own encryption mechanism, whereas audio/video will use
- Only one data stream exists, whereas audio/video can have many streams

I would like to propose an approach where we remove the send() method, and
add a createDataStream() method to PeerConnection. This method creates a
DataStream object, a descendant of MediaStream. This object can then be
added/removed from PeerConnection via the existing add/removeStream APIs,
and it will show up in localStreams/remoteStreams like any other
MediaStream. It will also fire events indicating the stream status.

Some specifics:
- This stream will show up in SDP, and it can be its own RTP session, or
muxed with other RTP sessions, just like any other audio/video stream. If
the remote side doesn't support/want the data stream, it can signal this via
its answer SDP.
- For encryption, it simply uses the underlying encryption of the session,
i.e. none, SDES-SRTP, or DTLS-SRTP, as appropriate.
- Multiple DataStreams can be created, just like MediaStreams. This may be
of value to certain applications, who want to have multiple flows, perhaps
with their own QoS.
- We can (perhaps later) add different kinds of DataStreams, i.e. datagram
and reliable. When creating a DataStream, you can specify what kind of
stream you want.

Example JS usage:

// standard setup from existing example
var local = new PeerConnection('TURNS example.net', sendSignalingChannel);
local.signalingChannel(...); // if we have a message from the other
side, pass it along here

// (aLocalStream is some LocalMediaStream object)

var aDataStream = local.createDataStream(DATAGRAM);


// outgoing SDP is dispatched, including a media block like:

m=application 49200 <TBD> 127

   a=rtpmap:127 application/html-peer-connection-data

function sendSignalingChannel(message) {
  ... // send message to the other side via the signaling channel

// incoming SDP is recieved, signaling completes
function receiveSignalingChannel (message) {
  // call this whenever we get a message on the signaling channel

// we start sending data on the data stream


Thoughts? If this feels like an interesting direction, I can write text for
inclusion in the spec.
Received on Friday, 2 September 2011 16:53:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:25 UTC