Lots of little ease of use tweaks
This commit is contained in:
1 parent
c1797474b8
commit
bc44b3db9a
15 files changed
+546
-161
No files matched your search
+20
-1
@@ -51,12 +51,31 @@ io.on('connection', function(socket){
|
||||
Auth.decodeToken(token)
|
||||
.then(userData => {
|
||||
socket.join(userData.userId)
|
||||
|
||||
//Track active logged in user accounts
|
||||
const usersInRoom = io.sockets.adapter.rooms[userData.userId]
|
||||
io.to(userData.userId).emit('update_active_user_count', usersInRoom.length)
|
||||
|
||||
}).catch(error => {
|
||||
//Don't add user to room if they are not logged in
|
||||
// console.log(error)
|
||||
})
|
||||
})
|
||||
|
||||
socket.on('get_active_user_count', token => {
|
||||
Auth.decodeToken(token)
|
||||
.then(userData => {
|
||||
socket.join(userData.userId)
|
||||
|
||||
//Track active logged in user accounts
|
||||
const usersInRoom = io.sockets.adapter.rooms[userData.userId]
|
||||
io.to(userData.userId).emit('update_active_user_count', usersInRoom.length)
|
||||
|
||||
}).catch(error => {
|
||||
// console.log(error)
|
||||
})
|
||||
})
|
||||
|
||||
//Renew Session tokens when users request a new one
|
||||
socket.on('renew_session_token', token => {
|
||||
|
||||
@@ -205,7 +224,7 @@ io.on('connection', function(socket){
|
||||
}
|
||||
})
|
||||
|
||||
socket.on('disconnect', function(){
|
||||
socket.on('disconnect', function(socket){
|
||||
// console.log('user disconnected');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user