RTCMultiConnection Docs

RTCMultiConnection API Reference / "transmitRoomOnce"

  1. transmitRoomOnce is useful to prevent sharing session info repeatedly.
  2. If transmitRoomOnce is not "true"; onNewSession will be fired multiple times for same session. You can manage this behavior like this:
  3. connection.transmitRoomOnce = true;
    connection.onNewSession = function(session) {};
    
    // if you don't set transmitRoomOnce; then you MUST be aware of 
    // "onNewSession" multi-times invocation for same session				
    var sessions = {};
    connection.onNewSession = function(session) {
         if(sessions[session.sessionid]) return;
         sessions[session.sessionid] = session;
    };
    
  4. By default, transmitRoomOnce is "false".
  5. If transmitRoomOnce is "false"; then you can set looping interval for session transmission.
  6. connection.transmitRoomOnce = false;
    connection.interval = 3000; // in milliseconds
    
    var sessions = {};
    connection.onNewSession = function(session) {
         if(sessions[session.sessionid]) return;
         sessions[session.sessionid] = session;
    };
    


Want to ask a Question?

You can include your email for private conversation!