Opening Scenario

You're building a collaborative document editor. When one user changes a paragraph, all other users need to see the change within a second. The standard HTTP request-response cycle doesn't help here — your server can't push data to clients; clients have to ask for it. You need to pick a mechanism that gets data from the server to the browser as soon as it's available.


Question Progression

1. What's the simplest way to get new data from the server without a user action?

Question: HTTP is request-driven — the client always initiates. You can't have the server proactively send data to a browser. What's the lowest-effort workaround?

Reasoning: If the server can't push, make the client ask repeatedly. Every N seconds, the client sends a fresh HTTP request: "anything new?" The server responds immediately with whatever it has (or an empty response if nothing changed). This works with standard HTTP…

In the full tutorial

  • Closing: When to Reach for This

Glossary history

Click dotted jargon to save explanations here.