====== onWrtcCmd() ====== wrtc.onWrtcCmd() is an event function called when user command has been received through [[ixnx:wrtc:rtcgate:start|RTCgate]] signaling channel. You can use this event to take care of the incoming user command. ===== Arguments ===== wrtc.onWrtcCmd(obj, msg) * obj - object: either a call object (indicating sender used [[ixnx:wrtc:js:api:call:adv.sendwrtccmd|call.adv.sendWrtcCmd()]] to send) or the wrtc object (indicating sender used [[ixnx:wrtc:js:api:wrtc:adv.sendwrtccmd|wrtc.adv.sendWrtcCmd()]] to send) * msg - the wrtc message received through the data channel: * msg.from - addressName of sender * msg.cmd - the user command (string or JSON) ===== Return value ===== Ignored. ===== Example ===== If sending client has sent {cmd: "ping"} using call.adv.sendWrtcCmd({cmd: "ping"}); you will receive a wrtc.onWrtcCmd() call with {cmd: "ping"} in its msg.cmd argument. Then you can respond with {cmd: "pong"}: wrtc.onWrtcCmd= function(obj, msg) { if ((msg.cmd.cmd) && (msg.cmd.cmd == "ping")) if (obj.objType == "call") obj.adv.sendWrtcCmd({cmd: "pong"}); else wrtc.adv.sendWrtcCmd(msg.from, {cmd: "pong"}); } ===== See also ===== [[ixnx:wrtc:js:api:wrtc:adv.sendwrtccmd|wrtc.adv.sendWrtcCmd()]] [[ixnx:wrtc:js:api:call:adv.sendwrtccmd|call.adv.sendWrtcCmd()]]