Hi Nicholas,
On a related note, I am wondering whether there is a way to know that
the client has closed the HTTP connection in the middle of sending a
chunked response stream, so that the server can stop sending as well.
Controller code would be similar to the following:
public class Application extends Controller {
public static void index() {
response.setContentTypeIfNotSet("text/plain");
while (true) {
response.writeChunk("somedata");
boolean closed = // ???
if (closed)
break;
}
}
}
This kind of use case is for streaming of live data, where the server
keeps sending the data indefinitely until the client closes the HTTP
connection. An example is streaming of live video from a camera.
Thanks.
Regards,
Yee Fan