Friday, February 13, 2009

Pushing data to browser

What will happen if a server don't close the TCP/IP connection after web page has finished loading? Right, it will wait until timeout, which could be quite a long period of time. That means we can use it to establish long-live connections (keeping them alive via some kind of polling) to provide server-to-client data push, events, bidirectional data streams, etc.

With AJAX such things became simpler, because no IFrames nor page reloads nor applets of any kind are necessary anymore. Instead nowadays we have Comet, which is an umbrella term for all such technologies, for example:
  • Bayeux protocol providing publish/subscribe model
  • BOSH for establishing bi-directional connections between client and server
Usually these things are combined with some kind of non-blocking IO on the server side in order to save resources there. For example, there exists integration with Grizzly.

No comments:

Post a Comment