handle reconnects correctly

This commit is contained in:
Jonas Weinz 2019-03-21 15:42:34 +01:00
parent 070a60a272
commit a5cfccbdfc

View File

@ -123,10 +123,12 @@ class ConnectionHandler(object):
conn = self.reconnect_session(socket, msg['data']['id']) conn = self.reconnect_session(socket, msg['data']['id'])
if conn is not None: if conn is not None:
self._add_connection(conn) self._add_connection(conn)
await conn.send(json.dumps({ await socket.send(json.dumps({
"type": "reconnect_response", "type": "reconnect_response",
"data": { "data": {
"success": True, "success": True,
"id": conn.id,
"user": conn.user_name,
"msg": "" "msg": ""
} }
})) }))
@ -135,6 +137,8 @@ class ConnectionHandler(object):
"type": "reconnect_response", "type": "reconnect_response",
"data": { "data": {
"success": False, "success": False,
"id": conn.id,
"user": conn.user_name,
"msg": "session not available" "msg": "session not available"
} }
})) }))