Better comments

This commit is contained in:
Patrick Jentsch 2020-04-30 12:56:59 +02:00
parent 08b909b9a8
commit a17771a772

View File

@ -69,7 +69,7 @@ def user_data_stream(app, user_id, session_id, foreign=False):
# Gather current values from database. # Gather current values from database.
user = User.query.get(user_id) user = User.query.get(user_id)
user_dict = user.to_dict() user_dict = user.to_dict()
# Send initial values to the user. # Send initial values to the client.
socketio.emit(init_event, json.dumps(user_dict), room=session_id) socketio.emit(init_event, json.dumps(user_dict), room=session_id)
while session_id in connected_sessions: while session_id in connected_sessions:
# Get new values from the database # Get new values from the database
@ -78,7 +78,7 @@ def user_data_stream(app, user_id, session_id, foreign=False):
# Compute JSON patches. # Compute JSON patches.
user_patch = jsonpatch.JsonPatch.from_diff(user_dict, user_patch = jsonpatch.JsonPatch.from_diff(user_dict,
new_user_dict) new_user_dict)
# In case there are patches, send them to the user. # In case there are patches, send them to the client.
if user_patch: if user_patch:
socketio.emit(update_event, user_patch.to_string(), socketio.emit(update_event, user_patch.to_string(),
room=session_id) room=session_id)