How does PHP handle client connection while doing sleeps?
Or put another way … what happens if the client closes the connection to the server while a page is being processed?
Does it just kill the process, or does it continue to process the page until the end?
Since I’m not sure of the answers to the above how would I implement the following pseudocode in PHP.
Record user entered while (user is still connected) { fetch changes in state since last awake send changes to user sleep(5); } Record user exit
Any thoughts would be appreciated.
Thanks.
Who knew?
Connection Handling Documentation – http://php.net/manual/en/features.connection-handling.php
From that page
register_shutdown_functionsolves the problem.Wonderful.