double check for closed connections

This commit is contained in:
j 2015-11-17 19:23:21 +01:00
parent c3548a1530
commit 1405582cc2

View file

@ -48,6 +48,9 @@ class Handler(WebSocketHandler):
def post(self, event, data): def post(self, event, data):
message = json_dumps([event, data]) message = json_dumps([event, data])
main = IOLoop.instance() main = IOLoop.instance()
if self.ws_connection is None:
self.on_close()
else:
main.add_callback(lambda: self.write_message(message)) main.add_callback(lambda: self.write_message(message))
def trigger_event(event, data): def trigger_event(event, data):