Recall & Review
beginner
What is polling in web applications?
Polling is a technique where the client repeatedly asks the server for updates at regular intervals.
Click to reveal answer
beginner
Why use polling as a fallback in Flask apps?
Polling is used as a fallback when real-time communication methods like WebSockets are not supported or fail, ensuring the client still receives updates.
Click to reveal answer
intermediate
How does polling work in a Flask app?
The client sends repeated HTTP requests to a Flask route that returns the latest data. The client waits a set time between requests.
Click to reveal answer
intermediate
What is a downside of polling compared to WebSockets?
Polling can cause more network traffic and latency because it sends requests even when no new data is available.
Click to reveal answer
intermediate
How can you implement polling in a Flask frontend?
Use JavaScript's setInterval to send fetch requests to a Flask endpoint periodically and update the page with the response.
Click to reveal answer
What does polling do in a Flask web app?
✗ Incorrect
Polling means the client asks the server repeatedly for updates.
Why might polling be used as a fallback?
✗ Incorrect
Polling is a fallback when real-time methods like WebSockets are unavailable.
Which JavaScript function is commonly used to implement polling?
✗ Incorrect
setInterval runs code repeatedly at fixed time intervals, perfect for polling.
What is a disadvantage of polling?
✗ Incorrect
Polling sends requests even if no new data is available, causing extra traffic.
In Flask, polling endpoints usually return what type of data?
✗ Incorrect
Polling endpoints typically return JSON data for easy client updates.
Explain how polling works as a fallback method in a Flask web application.
Think about how the client keeps asking the server for updates.
You got /4 concepts.
Describe the pros and cons of using polling compared to WebSockets in Flask apps.
Consider speed, network use, and compatibility.
You got /4 concepts.