Top 5 100% Free 3d 2d Animation Software in 2021 | Free Open Source Software

Socketio multi popup chat

For installation and other steps pls refer other pages.
----------- akash(owner) and pavan are friends so u need a room id:101

akash(owner) and Kishore are friends too so they need a room id:102

if Kishore(owner) and pavan are friends they need room id as 103

pavan(owner) and Kishore are friends means room id as 103

Change id or name and browse the html 


<!doctype html>
<title>Socket.IO chat</title>
.label {
font-weight: 800;
.box {
border:1px solid #d3dadd;
width: 500px;
margin-top: 10px;
.header, .footer {
min-height: 30px;
background-color: #d3dadd;
width: 100%
.body {
min-height: 300px;
background-color: #fff;
width: 100%;
.close {
cursor: pointer;
float: right;
<div class="owner label">Kishore</div>

<a href="" id="101" class="friend label">akash</a> 
<a href="" id="102"  class="friend label">pavan</a>

<!-- <input type="text" class="roomname" placeholder="Create Room id" /> -->
<div class="area"> </div>
<script src=""></script>
<script src=""></script>
<script src="http://localhost:8080/"></script>
<script type="text/javascript">

var socket=io('http://localhost:8080');

// on connection to server, ask for user's name with an anonymous callback
  socket.on('connect', function(){
    // call the server-side function 'adduser' and send one parameter (value of prompt)

      var owner=$('.owner').text();
      socket.emit('adduser', owner);


$(document).ready( function(){

      $(document).on('click','a', function(e){

       var friend=$(this).text();
       var roomname=$(this).attr('id');
       socket.emit('create_room', { friendname: friend,roomname:roomname});
       //socket.emit('add_to_room', friend);

        $(document).on('click','.close', function(){





        var friendname="";
        var roomname="";
          friendname = data.friendname
           roomname = data.roomname

            if($('#'+roomname+'_box' ).length == 0){

           $('.area').append("<div id='"+roomname+"_box' class='box'><div class='header'>"+friendname+":"+roomname+"<span id='"+roomname+"' class='close'>X<span></div><div id='"+roomname+"_msg' class='body'></div><div class='footer'><input id='"+roomname+"_txt' class='msg_txt'/><button id='"+roomname+"' class='send_btn' >Send</button></div></div>");


         var friendname = data.friendname
          var room_name = data.room_name
          var msg_data=data.msg_data



$(document).ready( function(){
   $(document).on('click','.send_btn', function(){
         var room_name="";
         room_name= $(this).attr('id');
        //var roomname=$('.roomname').val();

      var friendname=$('#'+room_name).text();
        var msg_data=$("#"+room_name+"_txt").val();
        var owner=$('.owner').text();

        socket.emit('send_msg',{ friendname: friendname, room_name: room_name,msg_data:msg_data,owner:owner });



     $(document).on('click','.close', function(){
         var room_name="";
         room_name= $(this).attr('id');





var app=require('express')();
var http=require('http').Server(app);

var io=require('')(http);
var users={};




// usernames which are currently connected to the chat
var usernames = {};
// rooms which are currently available in chat
var rooms = [];


// when the client emits 'adduser', this listens and executes
socket.on('adduser', function(username){
// store the username in the socket session for this client
socket.username = username;
// add the client's username to the global list
usernames[username] = username;
console.log("Owner connected:"+ socket.username);


// when the client emits 'adduser', this listens and executes
socket.on('create_room', function(data){

var friendname = data.friendname
         var roomname = data.roomname
// store the room name in the socket session for this client = roomname;
// send client to room 1

console.log("Room Created:"+ roomname);

//socket.username = friend;
console.log("Friend you clicked:"+ friendname);

socket.emit('room_created',{ friendname: friendname, roomname: roomname });


socket.on('send_msg', function(data){
 var friendname = data.friendname
          var room_name = data.room_name
          var msg_data=data.msg_data
          var owner=data.owner

          console.log("On Send Msg:"+friendname+" "+room_name+" "+msg_data+" "+socket.username);
'updatechat',{ friendname: friendname, room_name: room_name,msg_data:msg_data});


// when the user disconnects.. perform this
socket.on('disconnect', function(){
console.log("User leaved:"+socket.username);

// remove the username from global usernames list
delete usernames[socket.username];


// when the user disconnects.. perform this
socket.on('close_chat', function(room_name){
console.log("User leaved:"+socket.username);
 delete usernames[socket.username];


http.listen(8080, function(){

console.log("Listening at 8080");