I\'m looking to do long polling to \"push\" some data down to the client and I\'m also making other unrelated AJAX calls to the server in parallel with the long polling. It
it works for symfony 1.4. user session_write_close();
instead of $this->getUser()->shutdown();
This happens because of session file locks. In CakePHP you can choose other options for session management. You can save sessions in database, in cache etc. So you don't wait for file lock issues.
The built-in configurations are:
php - Saves sessions with the standard settings in your php.ini file.
cake - Saves sessions as files inside app/tmp/sessions. This is a good option when on hosts that don’t allow you to write outside your own home dir.
database - Use the built-in database sessions.
cache - Use the built-in cache sessions.
http://book.cakephp.org/2.0/en/development/sessions.html#built-in-session-handlers-configuration
Of course you can make session_write_close()
, but you should be sure that no changes needed in session between two page loads.
Similar question: Simultaneous Requests to PHP Script
Seems like you experienced the session file lock.
Perform session_write_close()
(or corresponding function in cakephp) to close the session in the begin of the ajax endpoint.