====== adv.sendData() ====== call.adv.sendData() is used to transmit data to other end of a call using a [[ixnx:wrtc:js:data_channel|data channel]]. If no data channel is available it will open one automatically - there is no need for you to call [[ixnx:wrtc:js:api:call:adv.adddatachannel|call.adv.addDataChannel()]] manually. Further calls to call.adv.sendData() will use that same data channel. ===== Arguments ===== call.adv.sendData(data) * data - string containing data to be sent. In theory all kind of data could be transferred (even binary) but due to browser incompatibilities you should only send strings up to 16 KB in length. ===== 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 ===== You should always check if data channel is supported before calling call.adv.sendData(): if call.is("dataChannelSupport") call.adv.sendData("HELLO"); This will trigger [[ixnx:wrtc:js:api:wrtc:ondatareceived|wrtc.onDataReceived()]] at the receiving end. ===== See also ===== [[ixnx:wrtc:js:api:wrtc:ondatareceived|wrtc.onDataReceived()]] [[ixnx:wrtc:js:data_channel|data channels]] [[ixnx:wrtc:js:api:call:is|call.is("dataChannelSupport")]] [[ixnx:wrtc:js:api:wrtc:onerror|wrtc.onError()]] [[ixnx:wrtc:js:api:call:adv.adddatachannel|call.adv.addDataChannel()]]