Edit in JSFiddle

 /*
             jsSocketNode.js is the MAIN file that does all the magic and automatically 
             provides IM, functions, Video Chat and SMS capability (see all the demos)
             To make this work, all you need to do is include the js file below like
             shown, and make sure that you have 2 cookies - first called 'login' that
             stores the    users login name, and another one called mobile - that stores
             the users mobile number (optional, required only for sms - you can store 
             a dummy random 10 digit number in there, but cookie must be present 
             for system to work). And thats it - you are all done!
             
             Again, step by step instructions:
             
             STEP 1:
             Include the main library file jsSocketNode.js
             
             STEP 2:
             Once you authenticate a user on your site (user login) all you need to do is:
             
             i.  Create a cookie called 'login' that stores the users login name
             ii. Create a cookie called 'mobile' that stores the users mobile number
             
             STEP 3:
             Call the xconnect function, passing in the login and mobile values.
             
             And there you go - all the users that are logged in will now appear under 
             the 'Online Now' header and each user can now be individually interacted
             with using:
             
             a. Instant Message (IM)
             b. Anonymous SMS
             c. Peer to peer browser based Video Call (no plugins etc)
            
             Go ahead and try it on here now! Login as User01 and User02 - each
             on a separate machine - and interact with each other to see it work:
             its literally 4 lines of code!
          */

 function connect(user, mobile) {
   setCookie('login', user)
   setCookie('mobile', mobile)
   xconnect(user, mobile)
 }
 /*
    Peer to peer Video IM can be implemented similarly, with one line of code;
    Say we have 2 users User01 and User02
    User01 wants to start a video call with User02
    User01 calls the function initVideo('User01','User02');
    Basically, to join 2 users in a video call, User01 goes to UR:

    https://terrawire.com/channel.html?action=1&login=User01

    User02 goes to URL:

    https://terrawire.com/channel.html?login=User02

    This is implemented automatically by the initiator calling the 
    video_call() function which sends an sms or email to User02 with 
    the appropriate link to join;
 */
<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
  </head>

  <body>
    <input type="button" class="btn btn-warning" value="Login as User01" onclick="connect('user01','13105676686')">
    <input type="button" class="btn btn-danger" value="Login as User02" onclick="connect('user02','17472335331')">
    <div id="log">

    </div>
    <script src="https://terrawire.com/jsSocketNode.js"></script>
  </body>

</html>
  * {
    font-weight: 300 !Important;
    font-family: Open Sans !Important
  }

  body {
    padding: 15px;
  }

  input {
    padding: 2px;
    height: 40px;
    border-radius: 4px;
    border: 0.5px solid skyblue;
    width: 50%;
    max-width: 200px
  }

  textarea {
    padding: 2px;
    height: 80px;
    border-radius: 4px;
    border: 0.5px solid skyblue;
    width: 50%;
    max-width: 200px
  }

  #frm {
    display: none;
  }

  #log {
    bottom: 0;
    position: absolute;
    height: 100px;
    background: #f0f0f0;
    width: 100%;
    border: 5px solid lightblue;
    font-family: Courier !Important;
    font-size: 21px;
  }

External resources loaded into this fiddle: