Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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