Subject: [rtcweb] Not an API proposal

From: Martin Thomson <[email-masked]>
Date: Tue, 12 Mar 2013 10:08:09 -0400

Keep in mind that this isn't the W3C.  This would be illustrative only.

partial interface RTCPeerConnection {
    RTCDataChannel createDataChannel(optional DataChannelProperties
properties);
    EventHandler ondatachannel;
};

dictionary DataChannelProperties {
    unsigned short streamId = (next available value);
    boolean ordered = true;
    long rtxCount = (really really big);
    long rtxTime = (really really big);
    [Clamp] unsigned short binaryPpid = (registered webrtc binary PPID);
    DOMString label = "";
    DOMString protocol = null;
};

interface RTCDataChannel {
    unsigned short streamId;
    boolean ordered;
    long rtxCount;
    long rtxTime;
    short binaryPpid;
    DOMString label;
    DOMString protocol;
};
RTCDataChannel implements WebSocket;

DataChannelMessageEvent : Event {
     short binaryPpid;
};

Usage for reliable, ordered text (basically the same as websockets):

var dc = pc.createDataChannel();
dc.send(text);
dc.onmessage = function(e) {
    console.log(e.message);
};

Advanced usage for something else...on request.  I need to pay more
attention to the session.