im new at (python, stackoverflow, tornado), so please be patient :). Correct me.
Im working with a tornado in a real time application. When I call self.close () inside the Websocket handler class, the on_close method does not start, since this time I made a small shell, fixed the problem and (for example) dropped the associated agent (pure avascript wss api client) correctly.
All network problems are thrown away since my bad shell works well and im in LAN environment.
Does anyone have the same problem? I canβt sleep without an explanation.
THANKS really.
AGENTS = set()
class BackofficeWSSRailMain(tornado.websocket.WebSocketHandler):
def on_open(self):
pass
def on_message(self,raw_message):
json_msg=json.loads(raw_message)
login = function_that_process_login(json_msg)
if login == True:
AGENTS.add(self)
self.write_message("ok")
else:
self.write_message("nologin")
self.close()
def on_close_wrapper(self):
self.close()
self.on_close()
def on_close(self):
AGENTS.discard(self)
source
share