RTCMultiConnection Docs

RTCMultiConnection API Reference / "Admin/Guest Scenarios"

  1. Note: Admin/Guest features has been removed since v1.7; you should use v1.6 or earlier versions to use these features.
  2. var you = new RTCMultiConnection();
    var he = new RTCMultiConnection();
    you.onRequest = function (e) {
        // you're "quickly" accepting his invitation
        // you can show a dialog-box too; to allow 
        // user accept/reject invitation
    // he is inviting you
    // following lines are necessary because we need to 
    // set signaling gateways
  3. Scenarios:
    1. You want to set multiple admins; you want to allow your website visitors (i.e. customers) to call you directly; you want to track customers presence too. Etc.
    2. You want to be an admin; and want to be able to invite any user in chatting room via his user-id (username). Etc.
  4. // if you want to set "admin"
    connection.userType = 'admin';
    // if you want to set "guest"
    connection.userType = 'guest';
    // Assuming that admin's userid is "admin-007"; lets call/invite him!
    // Assuming that guest's userid is "guest-007"; lets receive/accept his call
    connection.onRequest = function (e) {
  5. onAdmin:

    It is fired when an admin gets available; using it, you can allow customers to call him.
    connection.onAdmin = function (admin) {
        // Lets call admin using his userid
  6. onGuest:

    It is fired for each new customer; using it, you can detect presence of your customers; also you can call them too:
    connection.onGuest = function (guest) {
        // Lets call guest using his userid
  7. onRequest:

    It is fired if admin or guest makes a request using connection.request method:
    connection.onRequest = function (e) {
        // either accept
        // or reject
  8. onstats:

    Stats of the caller or callee:
    connection.onstats = function (stats, callee) {
        // callee is busy
        if (stats == 'busy') {}
        // callee rejected the request
        if (stats == 'rejected') {}
        // callee accepted caller's request
        if (stats == 'accepted') {}
        // callee.userid || callee.extra
  9. Remember

    1. One-way streaming is not supported for Admin/Guest feature; however you can ejoy all other features (listed at the top of this file)
    2. Admin/Guest relationship is one-to-one; however you can force "many-to-many" too; see below section
  10. Use Cases

    1. You want to be an administrator; and you want to manage users; you may want to invite users to your room; you many want to eject one or more users; etc.
    2. // be an administrator!!
      connection.userType = 'admin';
      // invite a user to your room
    3. If a user whose userid is target-userid is online; he will be alerted for invitation; he can accept your invitation or skip it!
    4. Remember, admin/guest feature is one-to-one; you can force many-to-many like this:
    5. connection.session['many-to-many'] = true;
  11. How to invite users?:

    1. First of all; set onAdmin/onGuest to prevent defaults execution:
    2. connection.onAdmin = connection.onGuest = function() {};
    3. Now, define onRequest to catch each invitation request:
    4. connection.onRequest = function (e) {
          // either accept
          // or reject
    5. He'll invite you using request method:
    6. // he'll use your user-id to invite you

Want to ask a Question?

You can include your email for private conversation!