发送同步消息后,在哪里可以从Janus WebRTC服务器捕获响应

时间:2018-11-11 22:37:13

标签: javascript webrtc video-conferencing janus-gateway

将videoroom插件附加到Janus后,在“成功”回调中,我向它发送同步消息

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

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

并从janus.js在控制台中获得响应,但在documentation中则告诉该插件将向我发送response消息。而且我不明白-在哪里可以抓到它?

onmessage: function(msg, jsep){

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

有人知道吗?

谢谢

1 个答案:

答案 0 :(得分:2)

您可以在请求对象中定义成功回调:

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