Grokking the System Design Interview
Vote

0% completed

Polling vs. Long-Polling vs. WebSockets vs. Webhooks

A customer pays for an order in an online shop. The shop's server does not charge the card itself. A payment provider, like Stripe, does that, and the confirmation takes a few seconds. How does the shop's system find out that the payment succeeded?

This kind of question appears everywhere in system design. Something happens in one place, and another part of the system needs to hear about it. This lesson compares four ways to deliver that news: polling, long polling, WebSockets, and webhooks.

.....

.....

.....

Like the course? Get enrolled and start learning!
Boni Mwenda

Boni Mwenda

· 9 days ago

The first three deliver updates from a server to its clients. The fourth, webhooks, delivers updates from one server to another server. That difference decides most of the choice.

This passage doesn't feel quite right for a few reasons. First is that servers can also be clients, it just depends on the direction of the request. Also, servers can also poll other servers and open web socket connections with them. The first sentence makes it look like the first three can only happen between a server and clients like browsers, mobile devices etc.

Given the previous lesson is about push vs pull, maybe it would make sense to discuss the four strategies here along those lines?

Show 1 reply
Nemanja Cukaric

Nemanja Cukaric

· a year ago

Add SSE and Pub/Sub architecture

Show 2 replies
Sachin Puranik

Sachin Puranik

· 2 years ago

server side events , is also a good candidate to be added here.

Show 1 reply
Deepak Gunaraj

Deepak Gunaraj

· 3 years ago

Where are the WebSockets as they are considered bi-directional and an excellent alternative for chat applicatons?

Show 1 reply

Reading Progress

0%


Vote for new content