====== onDataReceived() ====== wrtc.onDataReceived() is an event function called when data has been received on a [[ixnx:wrtc:js:data_channel|data channel]]. You can use this event to take care of incoming data through a data channel. ===== Arguments ===== wrtc.onDataReceived(callobj, data) * callobj - call object data has been received from. You can use this object to send answers back, see example below. * data - the data (usually a string) received through the data channel ===== Return value ===== Ignored. ===== Example ===== If sending client has sent "PING" using if call.is("dataChannelSupport") call.adv.sendData("PING"); you will receive a wrtc.onDataReceived() call with "PING" in it's data argument. Then you can respond with "PONG": wrtc.onDataReceived = function(callobj, data) { if (data == "PING") callobj.adv.sendData("PONG"); } ===== See also ===== [[ixnx:wrtc:js:data_channel|data channels]] [[ixnx:wrtc:js:api:call:adv.senddata|call.adv.sendData()]]