views:

177

answers:

1

I'm starting a personal project, so I have at the moment complete architectural/design control. I'm just planning out the structure at this point. My goal is some sort of web forum, chat thing. The difference is it should update live, new posts growing on client views soon after they've hit the server.

I think to use ajax and jquery to download a viewed thread's new posts (from a tomcat server), the posts will be some small XML structure that is compiled into a nice post on the client side. This hopefully reduces my bandwidth costs. Bandwidth is my primary concern. I'm worried that having a few users with a javascript thread polling the server every ten seconds will cause a storm of http requests to my server, even if the content is small.

Is there a better way than having each user perform polling? I can write the backend in any structure neccessary, frontend too for that matter. I want to stay away from Flash and Silverlight. As a public webpage it might end up with a lot of viewers (every web dev's deam). Having everyone polling at 30 second intervals will be an incredible number of hits to support, and 30 seconds is probably too slow for 'live view' anyway! My preferred language is JSP.

+1  A: 

Client side pooling is not the only option to implement "live view". You should consider, so called "Reverse AJAX" technique as well.

Furthermore you could use some of well established frameworks that provide you with that functionality out of the box: DWR or even JSF(ice faces).

Gennady Shumakher
Thanks, I've never heard of any of those three, so I've got some reading material now.
Karl
Then I would say you may find JSF technology too complex, when DWR is more lightweight.
Gennady Shumakher