long-polling

Disable ajaxStart() and ajaxStop() for a specific request

主宰稳场 提交于 2019-11-26 23:59:52
问题 I am using .ajaxStart() and .ajaxStop() to show a modal while an ajax request is being made. (between start and stop) Now I'd like to add a longpoll function that keeps waiting for notifications, similar to the one on the left upper corner of this site. My problem now lies in disabling this modal only for the longpolling request.. Registering "loading screen" on and off handlers: $(document).ajaxStart(handleAjaxStart); $(document).ajaxStop(handleAjaxStop); My longpoll function: $.ajax({

Differences between websockets and long polling for turn based game server

人盡茶涼 提交于 2019-11-26 23:47:04
问题 I am writing a server for an iOS game. The game is turn based and the only time the server needs to push information to the client is to notify of the opponent's move. I am curious if anyone could comment on the performance and ease of implementation differences between using websockets and long polling. Also, if I used websockets, should I only use it to receive information and send POST requests for everything else or should all communication be through the websocket? Additionally, is there

How is it possible to share single js resource between browser tabs?

╄→гoц情女王★ 提交于 2019-11-26 21:44:49
问题 For example I want to refresh chat messages by multiple tabs with socket.io, longpolling, etc... whatever I have... For that I want to use only a single connection for all of the tabs. How can I make this? I can store the common data in localStore, cookies, etc... And I need some kind of semaphore which gives only a single synchronizer resource to one of the tabs, and after that tab is closed, it gives to another tab, etc... How is that possible? The only solution came in my mind to tell the

Short-polling vs Long-polling for real time web applications?

天大地大妈咪最大 提交于 2019-11-26 19:43:10
I'm building a real-time web application As far as I know, the most popular choices are short-polling and long-polling. What are the advantages and disadvantages might there be for measuring one over the other? Short polling (a.k.a. AJAX based timer): Pros: simpler, not server consuming (if the time between requests is long). Cons: bad if you need to be notified WHEN the server event happens with no delay. Example ( ItsNat based) Long polling (a.k.a. Comet based on XHR) Pros: you are notified WHEN the server event happens with no delay. Cons: more complex and more server resources used.

Multiple AJAX requests delay each other

陌路散爱 提交于 2019-11-26 18:12:58
问题 I have a long polling request on my page. The script on the server side is set to timeout after 20 seconds. So, when the long polling is "idling", and the user presses another button, the sending of that new request is delayed until the previous script times out. I can't see anything wrong with the code on jQuery side. Why is the onclick-event delayed? function poll() { $.ajax({ url: "/xhr/poll/1", data: { user_id: app.user.id }, type: "POST", dataType: "JSON", success: pollComplete, error:

Chrome stalls when making multiple requests to same resource?

别说谁变了你拦得住时间么 提交于 2019-11-26 17:29:33
I'm trying to implement long polling for the first time, and I'm using XMLHttpRequest objects to do it. So far, I've been successful at getting events in Firefox and Internet Explorer 11, but Chrome strangely is the odd one out this time. I can load one page and it runs just fine. It makes the request right away and starts processing and displaying events. If I open the page in a second tab, one of the pages starts seeing delays in receiving events. In the dev tools window, I see multiple requests with this kind of timing: "Stalled" will range up to 20 seconds. It won't happen on every request

socket.io force a disconnect over XHR-polling

北城余情 提交于 2019-11-26 16:48:31
问题 I have a client/server application using nodejs on the server and socket.io as the connection mechanism. For reasons relevant to my application I want to have only one active connection per browser, and reject all the connections from other tabs that may be opened later on during the session. This works great with WebSockets, but if WebSockets is not supported by the browser and XHR-polling is used instead, the disconnection never happens, so if the user just refreshes the page, this is not

Long Polling/HTTP Streaming General Questions

守給你的承諾、 提交于 2019-11-26 09:29:01
问题 I\'m trying to make a theoretical web chat application with php and jquery, I\'ve read about long polling and http streaming, and I managed to apply most principles introduced in the articles. However, there are 2 main things I still can\'t get my head around. With Long Polling How will the server know when an update have been sent? will it need to query the databse continually or is there a better way? With HTTP Streaming How do I check for the results during the Ajax connection is still

Short-polling vs Long-polling for real time web applications?

試著忘記壹切 提交于 2019-11-26 07:23:06
问题 I\'m building a real-time web application As far as I know, the most popular choices are short-polling and long-polling. What are the advantages and disadvantages might there be for measuring one over the other? 回答1: Short polling (a.k.a. AJAX based timer): Pros: simpler, not server consuming (if the time between requests is long). Cons: bad if you need to be notified WHEN the server event happens with no delay. Example (ItsNat based) Long polling (a.k.a. Comet based on XHR) Pros: you are

Chrome stalls when making multiple requests to same resource?

。_饼干妹妹 提交于 2019-11-26 05:26:30
问题 I\'m trying to implement long polling for the first time, and I\'m using XMLHttpRequest objects to do it. So far, I\'ve been successful at getting events in Firefox and Internet Explorer 11, but Chrome strangely is the odd one out this time. I can load one page and it runs just fine. It makes the request right away and starts processing and displaying events. If I open the page in a second tab, one of the pages starts seeing delays in receiving events. In the dev tools window, I see multiple