Comment 3 for bug 1268619

Revision history for this message
Bill Erickson (berick) wrote :

Pushed code to do the following:

* Added support for a configurable inactivity timeout. After each message, inbound and outbound, are processed, we set a last activity time. A separate thread wakes periodically to see if the last activity time occurred beyond the timeout interval. After a period of inactivity, we send a disconnect to the client. This allows the websocket handler to exit and return control to Apache.

* How often we wake to check for inactivity is also configurable.

* Using the inactivity logic, if we receive a SIGUSR1 -- the Apache graceful / reload signal -- a shortened inactivity timeout is applied so that the client can be disconnected as soon as all open conversations are completed.

* Apache configuration for websockets lives in /etc/apache2-websockets/envvars. I put them there because standard Apache configuration directives cannot be created, since our websocket module is not an Apache module proper, but a shared library loaded by an apache module. Also, for reasons that are not clear to me, SetEnv and SetEnvIf failed to pass the environment to our websocket module. Exporting them in envvars works fine, though, and it means we don't have to enable either of the env mods, which would add to the memory requirements. (TODO: add example to repo)

* Javascript client lib now performs the connect dance under the covers, no need to manually initialize.

* When a JS client is disconnected from the server, it will reconnect when needed -- when the next request is sent -- and not automatically, so that we are not unnecessarily hogging Apache processes.