better online/offline status handling

This commit is contained in:
j 2015-12-02 22:05:23 +01:00
commit 8a26285c88
11 changed files with 92 additions and 40 deletions

View file

@ -9,6 +9,7 @@ import json
from oxtornado import json_dumps
import state
import settings
import logging
logger = logging.getLogger(__name__)
@ -33,6 +34,13 @@ class Handler(WebSocketHandler):
self.close()
if self not in state.websockets:
state.websockets.append(self)
trigger_event('status', {
'id': settings.USER_ID,
'online': state.online
})
if state.nodes:
for node in state.nodes._nodes.values():
node.trigger_status()
#websocket calls