I currently have a web application and I would like to add a messaging feature to it. In order to do that, I use JMS(actually OpenMQ, the implementation provided with Glassfish 3). The problem is that I do not know how to get the message notification from the background(from the listener) to the foreground. I am using JSF as a framework, if it does have an importance. Could you please tell me how should I notify the user about a received message(like a chat). Any suggestions are welcomed.


You may be interested in Comet, a programming model that allows the server to push data to a client. There are implementations for JSF, look at this blog post about Richfaces integration for an example.

HTML 5 specifies WebSockets that can be used for server push, but not all browsers support it.

The simple alternative is to simply poll the server at regular intervals, that might create a lot of unnecessary messages though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.