// Typescript file for core.rtcdatachannel in:
// https://github.com/freedomjs/freedom/blob/master/interface/core.rtcdatachannel.json
///
///
declare module freedom_RTCDataChannel {
interface Message {
// Exactly one of the below must be specified.
text ?:string;
buffer ?:ArrayBuffer;
binary ?:Blob; // Not yet supported in Chrome.
}
// Constructed by |freedom['rtcdatachannel'](id)| where |id| is a string
// representing the channel id created by an |rtcpeerconnection| object.
interface RTCDataChannel {
getLabel() : Promise;
getOrdered() : Promise;
getMaxPacketLifeTime() : Promise;
getMaxRetransmits() : Promise;
getProtocol() : Promise;
getNegotiated() : Promise;
getId() : Promise;
getReadyState() : Promise;
getBufferedAmount() : Promise;
on(t:'onopen', f:() => void) : void;
on(t:'onerror', f:() => void) : void;
on(t:'onclose', f:() => void) : void;
on(t:'onmessage', f:(m:Message) => void) : void;
on(t:string, f:Function) : void;
close() : Promise;
getBinaryType() : Promise;
setBinaryType(type:string) : Promise;
send(message:string) : Promise;
sendBuffer(message:ArrayBuffer) : Promise;
}
}