Server Communication: Long Poll, Comets, and Server Events (SSE)

I am developing a web application connected to a server, and I need the server to provide some information to clients at a given time.

So I started reading about events sent by the server (SSE), because the website was developed in HTML5, and the SSE seemed to match what I was looking for. But what a surprise, when I read what SSE really does is send a request from the client to the server instead of the return path (yesterday, I think I realized that a long poll is a kind of push emulation). So I'm starting to read about web sockets (but it's a seam that the standard is still a draft), and also looked at the comet. But I think that I can’t keep my mind shut.

Does anyone highlight these technologies (and possibly some other push tec.) That are relevant to my problem and which situation is more suitable for each of them?

Thank you very much, I think I completely lost this field.

+5
source share
1 answer

This post is the best explanation discussing the difference / advantages of / etc, about Long Polling, Comet, SSE and WebSockets.

For the most part, the client usually needs to make the first request to the server to establish a connection. After the connection is established, the server can transmit data to the client. Thus, even with WebSockets, the client will fulfill an initial request to the server to establish a reliable connection between them.

- HTTP- GET . . , . , HTTP-, , 15 -. - -, . . , ajax , . - , . (.. ) , Node.js, Ajax . Server-Sent Events EventSource. , / /, . , . - GET, Content-Type "text/event-stream" HTTP- .

, Server-Sent. HTTP GET-, , , 90% , .

SSE/Comet , . , , , . HTTP- , . SSE, HTTP- , - , / HTTP-. GET. ajax, SSE / EventSource.

: SSE .

+6

All Articles