views:

51

answers:

3

HI

I need to embed two web browsers in one form of a windows application (design wise, I have to separate them).

I also need to "communicate" between both - when the user clicks on a button in one web control, I have to disable a component in the other one.

I thought of using ajax:poll and push from primefaces, but I think that it's too expensive for network to keep a page on ajax:poll with intervals of 100 constancy.

Is there another way that you suggest to me?

A: 

http://dev.w3.org/html5/websockets/

I'm not sure if the browsers support this yet, but when they do it could be the solution you're looking for.

Erik B
+1  A: 

Have look into Ajax Comet programming. Seems to be exactly what you need.

Paul Whelan
A: 

HTTP polling or pushing are really the only resorts. Pushing is more efficient and suitable for this case. The PrimeFaces p:push makes use of Atmosphere under the hoods which is a pretty awesome concept. It is basically a transparent layer over all the various technologies known for HTTP push (CometProcessor, Grizzly Comet, Servlet 3.0 Async, Websockets, etc) and it automatically picks the right and best one whichever available.

Unfortunately the currently latest PrimeFaces version 2.1 doesn't work well with the currently latest Atmosphere version 0.6.x. You need Atmosphere 0.5.x until the PrimeFaces guys catches up the newer Atmosphere version.

See also:

BalusC
Thank you for the answer.Do you know what is the advantage of p:push over Comet regarding network loading? How much network does it consume?
Odelya
It consumes in fact practically nothing. Push is a matter of an open connection over which the data is been sent asynchronously. The only sent bits are really relevant (to send data, not to "poll" or so). Polling is more interesting if it concerns larger intervals, e.g. once a minute to keep session alive. This saves resources at the server side.
BalusC
When I log to primefaces demo page (http://www.primefaces.org/showcase/ui/chat.jsf) it seems to me that the browser'header (the circle in the tab - I use chrome) doesn't stop rolling. It looks as if the page is reloading data non stop. How can I stop this behavior?
Odelya
That's browser specific behaviour. Some browsers do that as long as the connection is open. You can only stop this by using polling or an embedded application like an applet.
BalusC