views:

36

answers:

2

I'm writing a servlet based back-end for a mobile phone app and I'm pretty new to web programming in general.

Anyways my issue is I have a data model that associates users to a general feed and when that feed is updated by any one user I want the rest of the users associated with the feed to receive the updated model.

From what I gather at the moment a servlet can only send a response when it receives a request which isn't exactly what I'm looking for as the users would need to ping the servlet for changes every once few seconds which doesn't seem very practical. Instead I want the server to send out the response to the users on its own when it detects changes in the model.

I'm sure there's a clean and well documented solution for this I just can't put a name to it. From what I gather I basically need to generate HttpResponses without explicit requests (I was thinking HttpSession objects would have a way of doing this but it doesn't seem like it).

+1  A: 

There are some updates in the Servlet 3.0 specification. Maybe you want to check out

As an alternative:

Christian Ullenboom
A: 

It seems using a Comet implementation is the best way to handle this type of server pushing. Thanks for pointing me in the right direction.