adv.addDataChannel()
call.adv.addDataChannel() can be used to add a data channel to a call.
The created data channel will be active until the call is ended. You can transmit data several times on it using call.adv.sendData() without the need to reopen it again.
Usually you do not explicitly need to call call.adv.addDataChannel() as call.adv.sendData() will call it if needed. You may however need to call call.adv.addDataChannel() if you want other constraints than the default {ordered: true} for the data channel.
Arguments
call.adv.addDataChannel(constraints)
- constraints - constraints to use when creating the data channel. If missing default is {ordered: true}
Returns
Nothing.
Errors
If data channel is not supported error 311 will occur. Check call.is("dataChannelSupport") to avoid getting errors on browsers not supporting data channels.
Example
if call.is("dataChannelSupport") {
call.adv.addDataChannel({ordered:false});
call.adv.sendData("HELLO");
}