I've been toying around with the concept of long polling (I'll explain below), but I'm starting to think that I may not be implementing it very well.
Long polling is a method where the client browser opens up a request to the server, but the server intentionally doesn't return a response right away. Instead, it waits until whatever information the client wanted is ready and then sends that information back. Once the client gets the information, it can open another connection to the server to wait for more information. Basically, this is a method to allow the server to push information to the client, rather than require the client to continually poll the server for updates.
The PHP sleep function seems to apply on a session basis (yes I have read the docs and it is quite clear on that point ). This poses problems with long polling because if I sleep script execution for 2 seconds, the user can't access other scripts during those 2 seconds.
tldr; Is there any way I can call a sleep function and just apply it to a single script execution, not the entire session?