Frage

I have a question with regards to the comet implementation. I know that it is used to handle asynchronous requests similar to what now can be achieved through Servlet 3.0 async functionality. Yet what i do not understand is how the push is done to the calling client.

In web sockets we open the connection by providing the ip and port. With comet, how do you connect with the server in order to receive call backs when the server pushes data?

War es hilfreich?

Lösung

The Wikipedia page on Comet (programming) is a pretty good resource for this question (sorry it's so obvious).

Comet is an umbrella term for using HTTP to simulate a bi-directional connection between a client and server. Ultimately you make an HTTP request to the server and attempt to hold it open (long polling and streaming). With long-polling that connection closes after a given interval or when data is returned. With streaming the connection is help open as long as possible and new data is sent over the existing connection.

How these are achieved differ between web browsers - that why Comet is classed as a hack. Again, the wikipedia page should provide almost all the information you need.

I wrote an article covering the history of realtime web communication (with a focus on client) and why WebSockets are a game-changer.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top