How to detect on client side that the server side state for the process is closed?

If you are using Eliom-base-app, you probably have nothing to do. Eliom-base-app will monitor the life of sessions and close the process when needed.

If you are not using Eliom-base-app, you must catch exceptions Eliom_comet.Channel_full, Eliom_comet.Channel_closed (and Eliom_comet.Process_closed on Eliom < 5). For example, you can use a channel with a different client-process scope to warn client processes that the session is closed. Have a look at module Eba_comet in Eliom-base-app.