Update server.js

This commit is contained in:
Nate Harris 2019-11-05 23:00:23 -05:00 committed by GitHub
parent 1d355b0271
commit fb190db4c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,11 @@ io.on('connection', function(socket) {
socket.on('room:count', function () { socket.on('room:count', function () {
if( socket.current_room !== undefined ) { if( socket.current_room !== undefined ) {
var clientsList = io.sockets.adapter.rooms[socket.current_room]; var clientsList = io.sockets.adapter.rooms[socket.current_room];
if( clientsList.length > 1) {
socket.emit('message:server', {msg:'person_count', payload: clientsList.length } ); socket.emit('message:server', {msg:'person_count', payload: clientsList.length } );
} else {
socket.emit('message:server', {msg:'person_single'} );
}
} else { } else {
socket.emit('message:server', {msg:'command_failed'} ); socket.emit('message:server', {msg:'command_failed'} );
} }