Ajax long polling does not work properly

I am developing a simple unfamiliar chat application using a long poll in MVC 2. Its work works fine on my development machine if I open the application in different browsers. I mean, if I downloaded the application in IE and mozilla, it works fine

if I took the application in two browser tabs (for example: IE), long polls do not work from both tabs. I mean, there is a start button to start a chat that launches a lengthy survey. I see that it triggers actions during debugging .. And my problem: when I clicked the start button from the first tab, it starts an ajax request (long poll (this req waits on the server until another reqst appears)), and then I click the button start in tab 2, it does not start an ajax request until the first request is returned from the server (after a timeout).

Why is this happening? I read how a browser blocks multiple ajax requests .. Is this the reason for this? .. Does this work fine if I use different browsers. The problem only occurred if I took two tabs in one browser.

+3
source share
1 answer

I read that the browser blocks multiple ajax requests.

Yes, if you use sessions, ASP.NET blocks concurrent requests from a single session. Quote from the documentation :

ASP.NET , , . , ( SessionID), . . ( , , -.) EnableSessionState @Page ReadOnly, . , , .

, . , jquery, cache: false :

$.ajax({
    url: '/poll',
    cache: false,
    success: function(result) {
        // ...
    }
});
+5

All Articles