The issue in your JS-PHP application stems from PHP’s session locking, which delays concurrent requests due to session_start(). To resolve this, add session_start() at the beginning of your script and use session_write_close() after updating $_SESSION['globalVar'] in the triggerLoop. This will release the session lock, allowing listen requests to access the updated session data promptly. Reopen the session with session_start() before the next iteration to ensure ongoing updates. This method allows listen requests to read session variables in real-time, preserving your application's functionality.