mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Adding real-time connection counts to logs.
This commit is contained in:
parent
2bdd2b587d
commit
070c37ccba
2 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,7 @@ REDIS_SERVER = if process.env.NODE_ENV == 'dev' then 'localhost' else 'db01'
|
|||
client = redis.createClient 6379, REDIS_SERVER
|
||||
|
||||
io.sockets.on 'connection', (socket) ->
|
||||
|
||||
console.log " ---> New connection brings total to #{io.sockets.clients().length} consumers."
|
||||
socket.on 'subscribe:feeds', (feeds, username) ->
|
||||
socket.subscribe?.end()
|
||||
socket.subscribe = redis.createClient 6379, REDIS_SERVER
|
||||
|
@ -20,5 +20,5 @@ io.sockets.on 'connection', (socket) ->
|
|||
|
||||
socket.on 'disconnect', () ->
|
||||
socket.subscribe?.end()
|
||||
console.log ' ---> [] Disconnect'
|
||||
console.log " ---> [] Disconnect, there are now #{io.sockets.clients().length-1} consumers."
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
client = redis.createClient(6379, REDIS_SERVER);
|
||||
|
||||
io.sockets.on('connection', function(socket) {
|
||||
console.log(" ---> New connection brings total to " + (io.sockets.clients().length) + " consumers.");
|
||||
socket.on('subscribe:feeds', function(feeds, username) {
|
||||
var _ref;
|
||||
if ((_ref = socket.subscribe) != null) _ref.end();
|
||||
|
@ -26,7 +27,7 @@
|
|||
return socket.on('disconnect', function() {
|
||||
var _ref;
|
||||
if ((_ref = socket.subscribe) != null) _ref.end();
|
||||
return console.log(' ---> [] Disconnect');
|
||||
return console.log(" ---> [] Disconnect, there are now " + (io.sockets.clients().length - 1) + " consumers.");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue