Running session_write_close() before sleep() in Laravel doesn't seem to be functioning as the session is still blocked from other requests until the current connection is complete.
I'm trying to sleep() in Laravel without blocking other requests. Found out that session_write_close() should resolve the problem as mentioned here: Long polling in Laravel (sleep() function make application freeze). But it doesn't work. sleep() is still blocking other requests.
The project app is a chat app using regular polling and long-polling: http://github.com/doncadavona/laravel-angularjs-chat
Directly to the code: https://github.com/doncadavona/laravel-angularjs-chat/blob/master/app/Http/Controllers/MessagesController.php
You can't use
session_start()orsession_write_close()in laravel.This is already a nature of PHP, thats why AJAX was created in order for us to have multiple request at the same time.