DataChannels API and external negotiation

Here's a proposed API for DataChannels with external negotiation, per 
the recent Interim and IETF meeting (most of this was in my previous W3 
email, but I've added info on when 'stream' is valid to read, and how 
even/odd roles are assigned for the IETF protocol). I'll note for the 
IETF folks that 'protocol' is in a JS dictionary object in this update, 
which avoids breaking any current experimental applications (and avoids 
them having any incentive to UA-sniff).  Also, I think it works better 
in the dictionary.

   channel = peerconnection.createDataChannel(label, dictionary_object);

/* If either maxRetransmitTime or maxRetransmitNum are set, it's
    unreliable, else it's a reliable channel.  If both are set it's an
    error.  outOfOrderAllowed can be used with any type of channel.  The
    equivalent of UDP is { outOfOrderAllowed: true, maxRetransmitNum: 0 }.
    The TCP equivalent is {}.

    preset is set to true if the channel is being externally negotiated, and
    no wireline OpenRequest message should be sent.  If preset is true, stream
    can be optionally used to set a specific SCTP stream to use.  If it's
    not set but preset is true, then the application should read the 'stream'
    attribute from the returned DataChannel after onopen and convey it to the
    other end to pass in via the DataChannelInit dictionary.
  */

dictionary DataChannelInit {
   boolean outOfOrderAllowed;
   unsigned short maxRetransmitTime;
   unsigned short maxRetransmitNum;
   DOMString protocol;
   boolean preset;
   unsigned short stream;
};

And I added to the DataChannel object webidl:

   readonly attribute DOMString protocol;
   /* the 'stream' attribute is not valid until after onopen has fired */
   readonly attribute unsigned short stream;


Even/odd roles for the underlying DataChannel protocol are tied to the 
DTLS roles on the DTLS connection.  These are only available after the 
DTLS connection is established, and so we will set the even/odd roles 
when the initial association is established (which is when onconnection 
fires, and then any queued DataChannels would have onopen fire).

-- 
Randell Jesup
randell-ietf@jesup.org

Received on Monday, 1 April 2013 02:31:20 UTC