====== adv.addDataChannel() ====== call.adv.addDataChannel() can be used to add a [[ixnx:wrtc:js:data_channel|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 [[ixnx:wrtc:js:api:call:adv.senddata|call.adv.sendData()]] without the need to reopen it again. **Usually you do not explicitly need to call call.adv.addDataChannel()** as [[ixnx:wrtc:js:api:call:adv.senddata|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 - [[https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel#RTCDataChannelInit_dictionary|constraints]] to use when creating the data channel. If missing default is {ordered: true} ===== Returns ===== Nothing. ===== Errors ===== If data channel is not supported [[ixnx:wrtc:js:api:wrtc:onerror|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"); } ===== See also ===== [[ixnx:wrtc:js:api:call:adv.senddata|call.adv.sendData()]] [[ixnx:wrtc:js:data_channel|data channels]] [[ixnx:wrtc:js:api:call:is|call.is("dataChannelSupport")]] [[ixnx:wrtc:js:api:wrtc:onerror|wrtc.onError()]]