Table of Contents

adv.sendData()

call.adv.sendData() is used to transmit data to other end of a call using a data channel.

If no data channel is available it will open one automatically - there is no need for you to call call.adv.addDataChannel() manually. Further calls to call.adv.sendData() will use that same data channel.

Arguments

call.adv.sendData(data)

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

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 wrtc.onDataReceived() at the receiving end.

See also

wrtc.onDataReceived()

data channels

call.is("dataChannelSupport")

wrtc.onError()

call.adv.addDataChannel()