Interview Bootcamp
Vote

0% completed

​

Difference Between Long-Polling, WebSockets, and Server-Sent Events

Long-Polling, WebSockets, and Server-Sent Events all solve the same problem: getting updates from the server to the client without refreshing the page. They just solve it in three different ways. Here is each one in a single sentence:

  • Long-Polling: the client asks, and the server holds the request open until it has data to send. After every answer, the client asks again.

.....

.....

.....

Like the course? Get enrolled and start learning!
Vu Tong

Vu Tong

· 5 months ago

It's worth to mention that to avoid performance impact, the server should have some kind of asynchronous processing for incoming requests. If the server uses a traditional thread-per-request model and every client holds a long-lived connection, that will hurt the overall performance.

Show 2 replies
D

dominikcubic

· 3 years ago

In this description of AJAX polling, is the "requested webpage" the same as the "Client"?

  1. Client requests data from a server using regular HTTP.
  2. The requested webpage opens a connection to the server.
  3. The server sends the data to the client whenever there's new information available.
Show 1 reply
H

heybenross

· 3 years ago

When should each be used? What are the pros and cons of each?

Show 2 replies

Reading Progress

0%


Vote for new content