long-polling

What does “xhr-polling” config do in socket.io?

旧巷老猫 提交于 2019-12-03 12:28:13
问题 I have a node.js server with socket.io: var io = require('socket.io').listen(app); // assuming io is the Socket.IO server object io.configure(function () { io.set("transports", ["xhr-polling"]); io.set("polling duration", 10); }); io.sockets.on('connection', function(socket){ console.log('connected: %s', socket.id); ... } With xhr-polling and a polling duration of 10 seconds, does this mean that a new connection will be invoked every 10 seconds? If so, how can I keep track of users if they

long polling netty nio framework java

冷暖自知 提交于 2019-12-03 12:21:29
问题 How can I do long-polling using netty framework? Say for example I fetch http://localhost/waitforx but waitforx is asynchronous because it has to wait for an event? Say for example it fetches something from a blocking queue(can only fetch when data in queue). When getting item from queue I would like to sent data back to client. Hopefully somebody can give me some tips how to do this. Many thanks 回答1: You could write a response header first, and then send the body (content) later from other

AJAX Polling Frequency - To long poll or not to long poll?

吃可爱长大的小学妹 提交于 2019-12-03 11:41:13
I'm building a component of a web page that needs relatively constant database polling. I can see two different approaches for this, and I'm wondering if one of them is better than the others, or if I'm missing a third option. 1) Send off an AJAX request every 1 or 2 seconds to check for updates. Each request returns immediately whether or not there is new data. 2) Fire off a single AJAX request that will not return until it receives data or a timeout occurs. Upon either of those happening, it fires off the next request. (I think this is called long polling?) The number of database queries

Can ASP.NET MVC's AsyncController be used to service large number of concurrent hanging requests (long poll)?

对着背影说爱祢 提交于 2019-12-03 10:08:37
问题 Frameworks like Node.js, Tornado, and Twisted let developers create server-push applications that supports large number of concurrent hanging requests (10k+). From what I understand, they all achieve this by not creating threads to service each hanging request. Can AsyncController be used to service large number of inactive concurrent requests? If so, are there any reasonably large ASP.NET MVC websites using this approach to create long-poll applications? 回答1: I recently wrote a simple

HTTP Long Polling in Swift

做~自己de王妃 提交于 2019-12-03 09:16:48
I am trying to implement a long-polling solution in Swift using iOS 8+. While the solution undoubtedly works and leaves the main thread free for UI interactions, the memory usage climbs continuously so I am obviously doing something wrong. The class I have written is as follows: enum LongPollError:ErrorType{ case IncorrectlyFormattedUrl case HttpError } public class LongPollingRequest: NSObject { var GlobalUserInitiatedQueue: dispatch_queue_t { return dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.rawValue), 0) } var GlobalBackgroundQueue: dispatch_queue_t { return dispatch_get_global

How can I update HTML pages dynamically with Indy HTTP server using jQuery and “Long Polling”?

核能气质少年 提交于 2019-12-03 08:14:45
I have read the article Simple Long Polling Example with JavaScript and jQuery . The paragraph "Long Polling - An Efficient Server-Push Technique" explains that the Long Polling technique combines the best-case traditional polling with persistent remote server connections. The term Long Polling itself is short for long-held HTTP request. How can I implement a Indy based HTTP server which uses Long Polling? Here is a self-contained example project, tested with Indy version 10.5.9 and Delphi 2009. When the application runs, navigate to http://127.0.0.1:8080/ . The server will then serve a HTML

Is “long polling” the most efficient way to create a Web Real Time App?

孤人 提交于 2019-12-03 07:26:43
问题 I want to create an application like this: http://collabedit.com/ What is the most efficient way to create this real time application? Flash? Long polling? Http Streaming? or something else? Thanks ;) 回答1: For now, long polling is probably the best solution. Many big-name sites have long polling implementations, including Facebook, Google and eBay. Not everyone has Flash installed/enabled in their browsers. In the future Web Sockets might be able to do an easier job of it for us. Update: As

Polling request for updating Backbone Models/Views

强颜欢笑 提交于 2019-12-03 07:15:00
问题 I need to find a way to update a web App implemented with backbone . The use case will be the following: I have several Views, and each View, or maybe model/collection related to this view, needs to make different polling request to the server at different time for discovering some change. I am wondering what is the most general way to: 1) implement the Traditional Polling Request 2) implement the Long Polling Request 3) implement the HTML5 web socket P.S.: 1) The server is written in PHP. 2)

Simple PHP long polling chat script, too simple?

萝らか妹 提交于 2019-12-03 07:02:32
Im working on a simple chat app, probably 10 to 20 users per room. The Script that queries the database for new messages looks too simple for all the request it'll be getting. Below is the block of code that loops for new messages, the rest of the script is just getting the variables, construction of the query and the json response object: $sleepTime = 1; //Seconds $data = ""; $timeout = 0; //Query database for data while(!$data and $timeout < 10){ $data = getQuery($sql); if(!$data){ //No new messages on the chat flush(); //Wait for new Messages sleep($sleepTime); $timeout += 1; }else{ break;

Long Polling Options: Nginx, PHP, Node.js

安稳与你 提交于 2019-12-03 06:49:13
I'm designing a long-polling app to broadcast small changes very rapidly to, possibly, a large number of users. The app will run in tandem with a website running a fairly standard cms. They'll both be running on one server, and to begin with so will the database. I come very much from a LAMP environment and I'm definitely a developer and not a sys-admin. That said I'm not afraid to try out some new things. I've spent the day researching my options and I'm hoping people can answer some questions and give me some recommendations. I have narrowed it down to these: A. Apache and php for the