Change person_count message if only one person
This commit is contained in:
		
							parent
							
								
									6ae2183385
								
							
						
					
					
						commit
						056110d7c4
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -53,7 +53,11 @@ io.on('connection', function(socket) {
 | 
			
		|||
	socket.on('room:count', function () {
 | 
			
		||||
		if( socket.current_room !== undefined ) {
 | 
			
		||||
			var clientsList = io.sockets.adapter.rooms[socket.current_room];
 | 
			
		||||
			socket.emit('message:server', {msg:'person_count', payload: clientsList.length } );
 | 
			
		||||
			if( clientsList.length > 1) {
 | 
			
		||||
				socket.emit('message:server', {msg:'person_count', payload: clientsList.length } );
 | 
			
		||||
			} else {
 | 
			
		||||
				socket.emit('message:server', {msg:'person_single'} );	
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			socket.emit('message:server', {msg:'command_failed'} );
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -99,4 +103,4 @@ io.on('connection', function(socket) {
 | 
			
		|||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue