How can something like BOSH be implemented using Java Servlets

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-06-05T16:46:29Z Indexed on 2010/06/05 16:52 UTC
Read the original article Hit count: 343

Filed under:
|
|
|

BOSH (Bidirectional-streams Over Synchronous HTTP) is a sneaky way of implementing 2-way client-server communication in situations where true server-push is not allowed, most obviously to let a server push data to a browser client without having to use client polling.

It works by the client sending a request to the server, and the server doesn't respond immediately... rather it remembers the request but only responds when it has some data to send. When this happens the client immediately sends another request so there is virtually always a 'stored request' sitting on the server ready to push data to the client.

At least, that's how I think it works!

My question is how you can do this using a Java EE stack i.e standard servlets. I'm rusty with them, is it allowed to send no response and cache the request somehow? If anyone could share (pseudo) code what a servlet class for handling BOSH might look like, I'd be real grateful.

© Stack Overflow or respective owner

Related posts about http

Related posts about servlets