javascriptwebrtcvideo-conferencingjanus-gateway

Where can I catch response from Janus WebRTC server after send synchronous message


After attaching videoroom plugin to Janus, in "success" callback i send synchronous message to it

janus.attach(
    {           
        plugin: "janus.plugin.videoroom",
        opaqueId: opaqueId,
        success: function(pluginHandle) {
            roomMaster = pluginHandle;
            var isExist = {
                "request" : "exists",
                "room" : myroom
            };

            roomMaster.send({"message": isExist})
        },

and get response in console from janus.js, but in documentation tells that plugin will send to me response message. And I can't understand - where i can catch it?

onmessage: function(msg, jsep){

    // is fired only after sending async requests like "join", "start" - not "exists"
    conslole.log(msg);  
}

Anybody know?

Thank you


Solution

  • You can define a success callback in the request object:

      roomHandle.send({ 
        "message" : {
          request : 'list'
        },
        success: function(result) {
          console.log(result);
        }      
      });