long-polling

socket.io force a disconnect over XHR-polling

不问归期 提交于 2019-11-27 14:32:57
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 interpreted as a reconnection ( I have a delay for reconnection and session restoring), but as a new tab

How to do long polling properly in MVC 3

我是研究僧i 提交于 2019-11-27 14:12:55
问题 I am trying to wire up an AsyncController so that when a user clicks save on an order on the order page, all users viewing the same order should get a notification that the order has changed. My approach to implement this is to do long polling ajax requests on the order page, however how to make a scalable AsyncController to deal with this is not obvious to me. So this is what I have so far, the ID is the ID of the order that is signaled as changed or polled for changes. public class

Amazon SQS Long Polling not returning all messages

雨燕双飞 提交于 2019-11-27 14:05:54
问题 I have a requirement to read all messages in my Amazon SQS queue in 1 read and then sort it based on created timestamp and do business logic on it. To make sure all the SQS hosts are checked for messages, I enabled long polling. The way I did that was to set the default wait time for the queue as 10 seconds. (Any value more than 0 will enable long polling). However when I tried to read the queue, it still did not give me all the messages and I had to do multiple reads to get all the messages.

How to use Servlet 3 @WebServlet & async with Spring MVC 3?

梦想的初衷 提交于 2019-11-27 13:57:11
问题 I would like to integrate the servlet 3.0 async support with spring MVC. Something like: @RequestMapping("/chat") @WebServlet(name="myServlet", asyncSupported=true) public String getMessage(String userName) { ...... } is it possible? 回答1: Not so fast, it is not that easy to implement good long polling. The method you mentioned works well, but there is a serious issue of "thread starvation" Each Long polling will use up one thread, if you have 1000 concurrent user you would need 1000 thread to

Tornado blocking asynchronous requests

*爱你&永不变心* 提交于 2019-11-27 10:38:52
问题 Using Tornado, I have a Get request that takes a long time as it makes many requests to another web service and processes the data, could take minutes to fully complete. I don't want this to block the entire web server from responding to other requests, which it currently does. As I understand it, Tornado is single threaded and executes each request synchronously, even though it handles them asynchronously (still confused on that bit). There are parts of the long process that could be pause

Chrome's loading indicator keeps spinning during XMLHttpRequest

不打扰是莪最后的温柔 提交于 2019-11-27 10:31:22
问题 I'm writing an AJAX web app that uses Comet/Long Polling to keep the web page up to date, and I noticed in Chrome, it treats the page as if it's always loading (icon for the tab keeps spinning). I thought this was normal for Google Chrome + Ajax because even Google Wave had this behaviour. Well today I noticed that Google Wave no longer keeps the loading icon spinning, anyone know how they fixed this? Here's my ajax call code var xmlHttpReq = false; // Mozilla/Safari if (window.XMLHttpRequest

how does long polling work javascript?

隐身守侯 提交于 2019-11-27 05:37:51
问题 Hi I understand that in long polling you keep the connection with the server open for long till you a get a response back from the server and then poll again and wait for the next response. However i dont seem to understand how to code it. There is this code below which uses long polling but I dont seem to get it (function poll(){ $.ajax({ url: "server", success: function(data){ //update page based on data }, dataType: "json", complete: poll, timeout: 30000 }); })(); But how is the connection

How to do long-polling AJAX requests in ASP.NET MVC? [duplicate]

纵饮孤独 提交于 2019-11-27 04:13:38
问题 This question already has an answer here: Comet implementation for ASP.NET? [closed] 8 answers Does anyone know how to code up long-polling AJAX requests (for server PUSH notifications) in ASP.NET MVC? Whenever I do it, it seems that only the last browser to open up a window gets the notifications. As if IIS/ASP.NET were canceling the last request because it was hung or something. 回答1: I recently wrote a simple example of a Long Polling Chat Server using MVC 3 Async Controllers based on a

How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Comet or long polling)

為{幸葍}努か 提交于 2019-11-27 04:10:53
问题 see also "WCF push to client through firewall" I need to have a WCF client that connect to a WCF server, then when some of the data changes on the server the clients need to update its display. As there is likely to be a firewall between the clients and the server. All communications must be over HTTP The server can not make an (physical) outgoing call to the client. As I am writing both the client and the server I do not need to limit the solution to only using soap etc. I am looking for

Long Polling/HTTP Streaming General Questions

允我心安 提交于 2019-11-27 00:47:18
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 active? I'm aware of jQuery's success function for ajax calls, but how do I check the data while the