I know there are ways to fake it, polling (or long polling) but is there any way to have the server contact the browser to push out information?
Either polling option wastes resources on the server and depending on the server can lock it up (apache and iis for example).
Seems like a lot of sites are using long polling to fake a server-side push mechanism over http. Wouldn't it just be better to have a true push protocol built into a browser?
What options are there that are server friendly to push (fake or otherwise) information to web browsers?
If you're using RIA technology like Adobe Flex, I believe the Flex version of a "server push" (AMF messaging) would meet your definition of a server push.
Of course you can also do the primitive ajax-y (hacky) polling method too, but there's no reason unless you're forced to.
May be technology has advanced from the time the question was asked ... I came across this one searching for something else.
WebPush is available in most of the browsers and there are several Push Notification providers that send information from the server to the browser. Other than few browsers like Safari, one can develop handlers which can be invoked when the notification arrives and perform some action on the client side browser.
The connection must be first established by the client to the server. There's no way of a server contacting a web client.
That's correct. Frequent polling is inefficient which is one of the reasons we are moving to a push world with persistent connections. WebSockets will be the best solution for this. I work for Pusher, a hosted realtime WebSocket solution, and we've seen a massive uptake in this technology driven by a community that believe it's the best solution to the resource and realtime communication problem.
Yes, that's why we now have WebSockets. HTTP solutions to web browsers are ultimately a hack and don't work consistently (in the same way) between browsers.
Related information and resources:
Um, no.
Your browser doesn't listen for incoming connections.
Nor would you want it to be able to. We have enough exploits as it is.
As others stated it is impossible for server to contact client without client request (on regular HTTP).
But if you looking for clean solution for push notificatinons, then look at Server-Sent Events. It is regular HTTP and works seamless with most of the browsers which support HTTP 1.1.
SSE works only in a single direction (server -> client), which is the main mechanic for push notifications. For client-> server communication you can always use Ajax. I made a summarize of this in Which technology for realtime communication for a web app?
You don't need to "fake" anything. Flash has a really nice and well fleshed out Socket object that works brilliantly, and you can write a tiny little Flash app that talks out to the web page, so you don't have to do anything in Flash other than the communication with the server (if you would prefer to build the page in HTML). You'll need a server side socket listener, of course, but those are pretty easy to throw together as well. Lots of documentation on-line for how to implement the whole thing.... Here's the first example I found (didn't look it over too closely, but looks like it would work nicely). http://www.giantflyingsaucer.com/blog/?p=205