Recall & Review
beginner
What is Flask-SocketIO used for?
Flask-SocketIO allows real-time communication between the client and server using WebSockets, enabling instant updates without refreshing the page.
Click to reveal answer
beginner
Which Python package do you install to use Flask-SocketIO?
You install the package named
flask-socketio using pip.Click to reveal answer
beginner
How do you initialize Flask-SocketIO in a Flask app?
Import <code>SocketIO</code> from <code>flask_socketio</code> and create an instance by passing the Flask app: <br><code>socketio = SocketIO(app)</code>Click to reveal answer
beginner
What method do you use to run the Flask app with SocketIO support?
Instead of
app.run(), use socketio.run(app) to enable WebSocket handling.Click to reveal answer
intermediate
How do you listen for a custom event from the client in Flask-SocketIO?
Use the
@socketio.on('event_name') decorator on a function to handle that event.Click to reveal answer
Which command installs Flask-SocketIO?
✗ Incorrect
The correct package name is
flask-socketio.How do you create a SocketIO instance in Flask?
✗ Incorrect
You pass the Flask app instance to
SocketIO when creating it.Which method runs the Flask app with SocketIO support?
✗ Incorrect
Use
socketio.run(app) to enable WebSocket handling.What decorator listens for a client event named 'message'?
✗ Incorrect
Use
@socketio.on('message') to handle the 'message' event.What protocol does Flask-SocketIO primarily use for real-time communication?
✗ Incorrect
Flask-SocketIO uses WebSocket protocol for real-time communication.
Explain the steps to set up Flask-SocketIO in a new Flask project.
Think about installation, imports, initialization, and running the app.
You got /5 concepts.
Describe how you handle a custom event sent from the client using Flask-SocketIO.
Focus on event listening and response.
You got /4 concepts.