Bird
0
0

You want to send a message only to users in the room 'lobby' except the sender. Which Flask-SocketIO function and parameter combination should you use?

hard📝 Application Q15 of 15
Flask - WebSocket and Real-Time
You want to send a message only to users in the room 'lobby' except the sender. Which Flask-SocketIO function and parameter combination should you use?
Asend(message, room='lobby', include_self=False)
Bsend(message, room='lobby', include_self=True)
Csend(message, broadcast=True)
Dsend(message, room='lobby')
Step-by-Step Solution
Solution:
  1. Step 1: Understand sending to a room excluding sender

    To send a message to a room but exclude the sender, use include_self=False.
  2. Step 2: Match parameters to desired behavior

    send(message, room='lobby', include_self=False) uses send with room='lobby' and include_self=False, which sends to all in 'lobby' except sender.
  3. Final Answer:

    send(message, room='lobby', include_self=False) -> Option A
  4. Quick Check:

    include_self=False excludes sender [OK]
Quick Trick: Use include_self=False to exclude sender in room message [OK]
Common Mistakes:
MISTAKES
  • Using include_self=True sends to sender too
  • Using broadcast=True sends to all clients
  • Omitting include_self sends to sender by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes