You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Alexander Farber <al...@gmail.com> on 2009/08/21 11:28:20 UTC
Closing KeepAlive connection - for "server push"
Hello,
I have a multiplayer flash game talking to an Apache module
(and the module in turn talks over a Unix pipe to the backend-daemon).
It works ok, but is naturally a bit sluggish because updates
are being polled by the flash client every 20 seconds.
I'd like to rewrite my application, so that a HTTP request
hangs if there is no new information and returns later -
when new infos from other players arrive at the server.
http://code.google.com/p/google-web-toolkit-incubator/wiki/ServerPushFAQ
recommends to close the KeepAlive connection
when returning the new information to the browser.
How can I forcibly close the KeepAlive connection from my module please?
Currently I open connection to the Unix pipe in
the child init phase and then in the handler phase
I read the GET or POST request, write to the pipe,
read back from the pipe and write to the browser:
ap_set_content_length(r, len);
ap_send_http_header(r);
if (len != ap_rwrite(buf, len, r)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"ap_rwrite (%u bytes) failed", len);
return HTTP_INTERNAL_SERVER_ERROR;
}
return OK;
Thank you for any ideas
Alex
PS: I'm using Apache 1.3.29 on OpenBSD 4.5 with
"KeepAlive On" and "KeepAliveTimeout 300"
Re: Closing KeepAlive connection - for "server push"
Posted by Sorin Manolache <so...@gmail.com>.
On Fri, Aug 21, 2009 at 11:28, Alexander
Farber<al...@gmail.com> wrote:
> Hello,
>
> I have a multiplayer flash game talking to an Apache module
> (and the module in turn talks over a Unix pipe to the backend-daemon).
> It works ok, but is naturally a bit sluggish because updates
> are being polled by the flash client every 20 seconds.
>
> I'd like to rewrite my application, so that a HTTP request
> hangs if there is no new information and returns later -
> when new infos from other players arrive at the server.
>
> http://code.google.com/p/google-web-toolkit-incubator/wiki/ServerPushFAQ
> recommends to close the KeepAlive connection
> when returning the new information to the browser.
>
> How can I forcibly close the KeepAlive connection from my module please?
>
> Currently I open connection to the Unix pipe in
> the child init phase and then in the handler phase
> I read the GET or POST request, write to the pipe,
> read back from the pipe and write to the browser:
>
> ap_set_content_length(r, len);
> ap_send_http_header(r);
>
> if (len != ap_rwrite(buf, len, r)) {
> ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
> "ap_rwrite (%u bytes) failed", len);
> return HTTP_INTERNAL_SERVER_ERROR;
> }
>
> return OK;
>
> Thank you for any ideas
> Alex
>
> PS: I'm using Apache 1.3.29 on OpenBSD 4.5 with
> "KeepAlive On" and "KeepAliveTimeout 300"
I have not tried it, but try
r->connection->keepalive = AP_CONN_CLOSE;
S
--
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?