Issue 60: A small proposal to cleanup DataChannel construction (and also improve WebRTC 1.0 compatibility)

Looking over the RTCDataChannel interface and comparing this against WebRTC 1.0, there are a bunch of differences whose justifications aren't clear to me.    As an example, the Editor's draft didn't include the readyState, bufferedAmount and binaryType attributes, nor did it include several of the EventHandlers, such as onerror.

To improve compatibility with WebRTC 1.0, I'd like to propose that we keep many of the WebRTC 1.0 constructs, while at the same time incorporating Peter's suggestions.  Here is what things would look like:

[Constructor(RTCDataTransport transport, RTCDataChannelParameters parameters)]
interface RTCDataChannel : EventTarget {
    readonly    attribute RTCDataTransport         transport;
    readonly    attribute RTCDataChannelParameters parameters;
    readonly    attribute RTCDataChannelState      readyState;
    readonly    attribute unsigned long            bufferedAmount;
                attribute DOMString                binaryType;
    void close ();
                attribute EventHandler             onopen;
                attribute EventHandler             onerror;
                attribute EventHandler             onclose;
                attribute EventHandler             onmessage;
    void send (DOMString data);
    void send (Blob data);
    void send (ArrayBuffer data);
    void send (ArrayBufferView data);
};

dictionary RTCDataChannelParameters {
    DOMString?      label = "";
    boolean         ordered = true;
    unsigned short? maxPacketLifetime = null;
    unsigned short? maxRetransmits = null;
    DOMString?      protocol = "";
    boolean         negotiated = false;
    unsigned short? id = null;
};

interface RTCDataTransport {
};

enum RTCDataChannelState {
    "connecting",
    "open",
    "closing",
    "closed"
};

[Constructor(RTCDtlsTransport)]
interface RTCSctpTransport : RTCDataTransport {
                attribute RTCDtlsTransport transport;
    static RTCSctpCapabilities getCapabilities ();
    void                       start (RTCSctpCapabilities remoteCaps);
    void                       stop ();
                attribute EventHandler     ondatachannel;
};

Received on Friday, 25 April 2014 21:56:20 UTC