Option for auto close project when no client listen

And fix websocket not correctly detected has closed.

Ref https://github.com/GNS3/gns3-gui/issues/1331
This commit is contained in:
Julien Duponchelle committed 2016-08-16 17:35:43 +02:00
1 parent 9e81994adc
commit 9694850465
4 files changed
+26

No files matched your search

@@ -32,11 +32,16 @@ class NotificationHandler:
ws = WebSocketResponse()
yield from ws.prepare(request)
# Process ping / pong and close message
asyncio.async(ws.receive())
with notifications.queue() as queue:
while True:
try:
notification = yield from queue.get_json(5)
except asyncio.futures.CancelledError:
break
if ws.closed:
break
ws.send_str(notification)
return ws