Recall & Review
beginner
What is a common alternative to Server-Sent Events (SSE) for real-time communication in Flask?
WebSockets are a common alternative to SSE. They allow two-way communication between client and server, unlike SSE which is one-way from server to client.
Click to reveal answer
intermediate
How does WebSocket communication differ from Server-Sent Events?
WebSockets provide full-duplex communication, meaning both client and server can send messages independently. SSE only allows the server to push updates to the client.
Click to reveal answer
beginner
Which Flask extension helps implement WebSockets easily?
Flask-SocketIO is a popular extension that simplifies adding WebSocket support to Flask applications.
Click to reveal answer
intermediate
What is a key benefit of using WebSockets over SSE in a chat application?
WebSockets allow instant two-way messaging, so users can send and receive messages in real time without refreshing or waiting for server pushes.
Click to reveal answer
intermediate
Can WebSockets work over the same HTTP ports as SSE?
Yes, WebSockets start with an HTTP handshake on the same ports (usually 80 or 443) and then upgrade the connection to a persistent socket.
Click to reveal answer
Which of these is a two-way communication protocol suitable as an SSE alternative?
✗ Incorrect
WebSockets allow two-way communication, unlike SSE which is one-way from server to client.
Which Flask extension is commonly used to add WebSocket support?
✗ Incorrect
Flask-SocketIO simplifies WebSocket integration in Flask apps.
What is a limitation of Server-Sent Events compared to WebSockets?
✗ Incorrect
SSE only allows server-to-client messages, no client-to-server communication.
How do WebSockets start their connection?
✗ Incorrect
WebSockets begin with an HTTP handshake and then upgrade to a persistent socket connection.
Which scenario benefits most from WebSockets over SSE?
✗ Incorrect
Interactive chat apps need two-way communication, which WebSockets provide.
Explain why WebSockets are often preferred over Server-Sent Events for real-time apps in Flask.
Think about how messages flow between client and server.
You got /4 concepts.
Describe how a WebSocket connection is established starting from an HTTP request.
Consider the initial steps before the connection stays open.
You got /4 concepts.