notexOPENOverview
Notex/Systems/Long polling
12.05LESSON 05 OF 13 · 1 MIN READ

Long polling

Always free to read
SECTION VIDEOLong polling

Video coming soon. Start with the reading below.

COMING SOON

Because polling could be inefficient, the next progression is long polling (Figure 12-4).

Design a chat system — original diagram 148

In long polling, a client holds the connection open until there are actually new messages available or a timeout threshold has been reached. Once the client receives new messages, it immediately sends another request to the server, restarting the process. Long polling has a few drawbacks:

  • Sender and receiver may not connect to the same chat server. HTTP based servers are usually stateless. If you use round robin for load balancing, the server that receives the message might not have a long-polling connection with the client who receives the message.
  • A server has no good way to tell if a client is disconnected.
  • It is inefficient. If a user does not chat much, long polling still makes periodic connections after timeouts.
Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K