Reputation: 339
I'm currently workin' on a simulation environment build with spring (webflow) and jsf (and primefaces). Within my environment messages are generated when some events are triggered by the server (for instance the "cash Position" of a player has changed). I want this messages to be displayed in my webapplication every time they are triggered.
I think I'll have to use someting like reverse AJAX, but I wasn't able to make it run within my application. Now I wanted to know if you see any other possibilities respectively techniques to acheive my goal.
Upvotes: 1
Views: 512
Reputation: 10463
In a typical Server/Client model a TCP socket connection would be the best approach because the connection is typically left open allowing the server and client to send messages back and forth to each other bidirectionally.
AJAX communication is essentially HTTP protocol and is by default a stateless Client Request/Server Response unidirectional model.
A custom polling AJAX component like the one linked from micfra is a good example of how to address this problem. A custom polling component can be built with AJAX and Javascript as well. Essentially the client needs to ask the server for status updates after so many intervals. If the server has a status update or new information, then using Javascript events one can update the information on the client as well as the server.
Upvotes: 0
Reputation: 2820
You can do a constant AJAX poll using the components shown here http://www.primefaces.org/showcase/ui/ajaxPollHome.jsf.
Upvotes: 3