black
This commit is contained in:
parent
398ab9d85e
commit
844bddfd18
1 changed files with 4 additions and 2 deletions
6
app.py
6
app.py
|
|
@ -96,7 +96,10 @@ def chat(room_name):
|
|||
username = request.args.get("username", "guest")
|
||||
|
||||
# Pass username and rooms into the template
|
||||
return render_template("chat.html", room_name=room_name, rooms=rooms, username=username)
|
||||
return render_template(
|
||||
"chat.html", room_name=room_name, rooms=rooms, username=username
|
||||
)
|
||||
|
||||
|
||||
@socketio.on("join")
|
||||
def on_join(data):
|
||||
|
|
@ -113,7 +116,6 @@ def on_join(data):
|
|||
# Fetch previous messages from the database
|
||||
previous_messages = Message.query.filter_by(room_id=room.id).all()
|
||||
|
||||
|
||||
# Send the history of messages only to the newly connected client.
|
||||
# The reason for using `request.sid` here is to target the specific session (or client) that
|
||||
# just connected, so only they receive the backlog of messages, rather than broadcasting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue