Javascript – How to you push data to a web page client


I just learned about the AJAX Push Engine but it runs on Linux/Apache which is not an option for me.

Currently with AJAX to keep a page current I have to poll the server frequently which is not great for a high traffic site. The option to push data to the client only when necessary is a great option, but natively JavaScript does not support sockets, AFAIK. One trick I read about, but the site is now gone, is to use a Flash module to handle socket communications and relay message to JavaScript.

The trouble with researching this approach is that "JavaScript push" as keywords come up with the push function for arrays instead of the context I want.

How could establish a persistent connection with the server to do push communications in the browser? Do I need Flash/ActionScript or is there another option that would work with all of the currently active browsers? (IE6/7/8, FF3, Safari, Chrome)

When it comes to the server I also need to work out the complications due to Origin policy as well as port security. I appreciate anything you can point out that will explain the available options.

Best Solution

What you want is COMET, or I would also look up long polling.

I asked a similar question.