Search code examples
phpxmlhttprequestlong-polling

Long Polling Blocks my other Ajax Requests


ok I do use an Apache Server and I have the following situations.

  1. I have a JScript that sends a XHR request to a long polling PHP file
  2. Now the request is long polled for 15 secs
  3. Now while the long poll is in progress I try to send another XHR request
  4. But the another XHR request timeouts and seems not to reach my Apache server

now my question is, why this happens? is this because Apache server uses only a single thread connection for a single client? or because of long polling the connection became persistent other XHR request can't be granted?

my server is a XAMPP 1.8.0 with Apache 2.4.2


Solution

  • found already the answer here.

    I need to use the function below

    session_write_close();
    

    Long polling locking up other AJAX calls