Advertisment

Learn Differences Between Long-Polling, Web sockets and Server-Sent Events?


Differences Between Long-Polling, Web sockets and Server-Sent Events
                Long- polling
                                I.            Client requested to web page from a server using the HTTP.
                              II.            The request web page executes Java script which requests a file from the server.
                            III.            The server donate quickly respond with the requested information but waits until there’s new information available.
                            IV.            When new information available the server respond with the new information.
                              V.            The client receives the information and sends another request to the server, re-starting the process.

             Server sent Events

Like the long polling
  1.   Client sent request
  2.   Webpage execute it
  3.   The server send an event to the client when new information available.
  4.       Real time traffic from server to client that we shall need.
  5.        We’ll want to use a server that has an event loop.
  6.          Not possible to connect with a server from another domain

Web Sockets
Like previousA client requested to webpage
The request webpage execute Java script
The server and client now send message each other when new data is available.
·         Real- time traffic from the server to the client and from the client to the server.
·         We will want to use a server that has an event lap.
·         With web sockets it is possible to connect with a server from another domain.
·         It is also possible to use a third party hosted web socket server for example pusher or others.
·         This way we will only have to implement the client side which is very easy.

Share on Google Plus

About bilal S

I am founder of javaHint.com and a Computer Scientist. I have studied Computer Science and currently enrolled research student .I am providing information about computer, s web Programming Languages, Architecture and All other basic information Such as Information Technology and Computer Science. For Any Query and suggestion you are always welcome to contact me.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment