From 1405582cc255d1cd38915e4722be7d9f7343e491 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Nov 2015 19:23:21 +0100 Subject: [PATCH] double check for closed connections --- oml/websocket.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oml/websocket.py b/oml/websocket.py index e12544e..58ecd06 100644 --- a/oml/websocket.py +++ b/oml/websocket.py @@ -48,7 +48,10 @@ class Handler(WebSocketHandler): def post(self, event, data): message = json_dumps([event, data]) main = IOLoop.instance() - main.add_callback(lambda: self.write_message(message)) + if self.ws_connection is None: + self.on_close() + else: + main.add_callback(lambda: self.write_message(message)) def trigger_event(event, data): if len(state.websockets):