Jump to content

AJAX Long Polling, I can't do asynchronous requests sumultaneously


RussellReal

Recommended Posts

I understand that many browsers have limitations (such as 6 requests per "group" meaning I guess how many tabs you have for lets say 'google.com')

 

Now, I only have 1 constant request..

 

It starts, and has a timeout of 60 seconds, I then start a separate request to "send" a message to the server, which will impact what is "returned" by the server on the longpoll connection..

 

My current model, or design, albiet fully functional, has 1 major flaw..

 

A request is made to the server, which islong polled, (E.G. thrown into a loop)

 

The Long Poll will continue to long poll until one of the following two conditions are satisfied..

 

1) The time() is > initial_time+60seconds

2) There is data to be displayed, and found..

 

the above works just fine.. However, while this is running, if I try to send a Message to the server, javascript wants to wait until the previous request has finished, before sending another request.. which sometimes could take a full minute to showup.. Hardly real time, which defeats the purpose of long polling?

 

I figure maybe you can't have two connections running at the same exact time in Google Chrome, so I stop the current long poll

 

- XMLHttpRequest.abort() -

 

But that still, takes until the request (the server side code) ends processing and still takes up to 60 seconds until the message is sent to the server (which seems to be because it is processing till a specific time)...

 

this is extremely frustrating..

 

is there any way to fix this problem?

 

Thank you all very much!

Link to comment
Share on other sites

Nvm, I've figured it out, I can't believe I overlooked the session over and over, no wonder it wasn't working, there was a lock on the session so each request after the first needed to way to secure a lock on the session file..

 

Thanks PHPFreaks, sorry for the nooby problem! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.