pushlet vs long polling as a push technology

373 views Asked by At
1

There are 1 answers

1
Mahesh On

Taking citations from the same wiki page :

"Pushlet - the server takes advantage of persistent HTTP connections"

That is, idea of using a single TCP connection to send and receive multiple HTTP requests/responses. So, if a request is sent from the client, the server side uses the same connection to send data multiple times (of course, till the time the TCP connection is open). The Keep-Alive time is configurable in various servers and can be tuned.

"Long-polling - If the server has no new information for the client when the poll is received, instead of sending an empty response, the server holds the request open and waits for response information to become available. Once it does have new information, the server immediately sends an HTTP/S response to the client, completing the open HTTP/S Request"

That is, the response is never committed to the client, till the time the server has some information to be shared / returned. Refer below URL to have a working sample in Node.JS :

https://dzone.com/articles/diving-nodejs-%E2%80%93-long-polling