javascript/index.js
//this methods is called when a new user is connected when you in the room 
this methods is called when a new user is connected when you in the room
this methods is called when a new user is connected when you in the room
function resp_on_user_connected( user_id ){
	  console.log("new user %s enter",user_id); 
	setTimeout(update_room_list, 200,this);
	setTimeout(trigger_room_infor,300,this);
	if(this.master == 1){
		for(var id_key in UserInfor){
			var user_msg_obj = {"type": "user_infor", "user_id": null, "user_name":null};
			user_msg_obj.user_id = id_key;
			user_msg_obj.user_name = UserInfor[id_key];
			this.sendMessage(JSON.stringify(user_msg_obj), user_id);
			console.log("send %s userInfor: %s ", user_id,JSON.stringify(user_msg_obj));
		}
		setTimeout(send_history,400,this,user_id);
	}
}
function resp_on_user_connected ( user_id ) { console . log ( "new user %s enter" , user_id ) ; setTimeout ( update_room_list , 200 , this ) ; setTimeout ( trigger_room_infor , 300 , this ) ; if ( this . master == 1 ) { for ( var id_key in UserInfor ) { var user_msg_obj = { "type" : "user_infor" , "user_id" : null , "user_name" : null } ; user_msg_obj . user_id = id_key ; user_msg_obj . user_name = UserInfor [ id_key ] ; this . sendMessage ( JSON . stringify ( user_msg_obj ) , user_id ) ; console . log ( "send %s userInfor: %s " , user_id , JSON . stringify ( user_msg_obj ) ) ; } setTimeout ( send_history , 400 , this , user_id ) ; } }
this methods is called when a new user is connected when you in the room
this methods is called when a new user is connected when you in the room
//new user! //send user_infor