Skip to content

Commit

Permalink
Fix: leave room while async disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Flova authored and timonegk committed Jun 20, 2020
1 parent 3183c54 commit c6eeac3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lecture2gether_flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def on_leave(data):
if not room_token in rooms(sid=request.sid):
return {'status_code': 403}, 403

leave_room(room_token)
# Get room from db
room = json.loads(db.hget('rooms', room_token))
# Deacrease active users in room
Expand All @@ -234,8 +235,7 @@ def on_leave(data):
emit('room_user_count_update', {"users": room['count']}, room=room_token)
# Save in db
db.hset('rooms', room_token, json.dumps(room))
# Leave the socket.io room
leave_room(room_token)

# Return status
return {'status_code': 200}, 200

Expand Down

0 comments on commit c6eeac3

Please sign in to comment.