Questions tagged [long-polling]

In web programming, long-polling is an emulation of pushing data, implemented by repeated polling with delayed response.

Long polling is itself not a true push; long polling is a variation of the traditional polling technique, but it allows emulating a push mechanism under circumstances where a real push is not possible, such as sites with security policies that require rejection of incoming HTTP/S Requests.

1099 questions
12
votes
3 answers

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

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 ;)
xRobot
  • 25,579
  • 69
  • 184
  • 304
12
votes
4 answers

Amazon SQS Long Polling not returning all messages

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…
kaputabo
  • 343
  • 1
  • 3
  • 12
12
votes
4 answers

Long polling - Message system

I'm looking into doing some long polling with jQuery and PHP for a message system. I'm curious to know the best/most efficient way to achieve this. I'm basing is off this Simple Long Polling Example. If a user is sitting on the inbox page, I want to…
SeanWM
  • 16,789
  • 7
  • 51
  • 83
12
votes
3 answers

Simplest way to implement backend server for multiplayer JavaScript game? (COMET/longpolling)

I've been writing a game in JavaScript, and it's time to make it multiplayer. I would like to use AJAX long-polling to get the current game state, as well as implement the lobby. The server just needs to perform basic functions, like store the…
Zack Burt
  • 8,257
  • 10
  • 53
  • 81
11
votes
1 answer

Using of "skipWhile" combined with "repeatWhen" in RxJava to implement server polling

I really like the RxJava, it's a wonderful tool but somethimes it's very hard to understand how it works. We use Retrofit with a RxJava in our Android project and there is a following use-case: I need to poll the server, with some delay between…
Danylo Volokh
  • 4,149
  • 2
  • 33
  • 40
11
votes
1 answer

Grabbing tagged instagram photos in real time

I'm trying to download photos posted with specific tag in real time. I found real time api pretty useless so I'm using long polling strategy. Below is pseudocode with comments of sublte bugs in it newMediaCount = getMediaCount(); delta =…
user2418306
  • 2,352
  • 1
  • 22
  • 33
11
votes
5 answers

how to close/abort a Golang http.Client POST prematurely

I'm using http.Client for the client-side implementation of a long-poll: resp, err := client.Post(url, "application/json", bytes.NewBuffer(jsonPostBytes)) if err != nil { panic(err) } defer resp.Body.Close() var results []*ResponseMessage err =…
George Armhold
  • 30,824
  • 50
  • 153
  • 232
11
votes
1 answer

Is Visual Studio's Browser Link feature able to use web sockets?

I understand that SignalR is used to communicate with client browsers using the injected artery script. I have what seems to be a common problem, which is that my browser's network log is filled with entries that look like…
Daniel Revell
  • 8,338
  • 14
  • 57
  • 95
10
votes
2 answers

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

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); …
Michael Eilers Smith
  • 8,466
  • 20
  • 71
  • 106
10
votes
1 answer

React Query: Can I use React Query for polling until I get certain data?

I want to implement long-polling until I get certain data from an API. For example, let's say we have an API that returns the progress of a process. And I want to call that API until the process is finished. Is it feasible and if so, how can I…
Ever Dev
  • 1,882
  • 2
  • 14
  • 34
10
votes
2 answers

AJAX Polling vs. WebSockets Mobile Performance

I'm currently developing a site in Django that I'd like to implement some sort of quasi-realtime update system for. Since this site is intended for mobile devices, I was wondering what the performance comparison was between periodically polling the…
CCSab
  • 1,455
  • 3
  • 16
  • 27
10
votes
2 answers

When should curl_close() be used?

The below script will operate indefinitely and will be initiated by using php myscript.php. http://example.com/longpolling.php will only respond if it has something to communicate to php myscript.php, and the below curl request will timeout before…
user1032531
  • 24,767
  • 68
  • 217
  • 387
10
votes
2 answers

HTTP Long Polling - Timeout best practice

I play with Javascript AJAX and long-polling. Try to find best value for server response timeout. I read many docs but couldn't find a detailed explanation for timeout. Someone choose 20 secs, other 30 secs... I use logic like on diagram How can I…
Dmitry
  • 877
  • 1
  • 16
  • 30
10
votes
1 answer

Long Polling in Python with Flask

I'm trying to do long polling with JQuery and Python under the Flask Framework. Having done long polling before in PHP, I've tried to go about it in the same way: A script/function that has a while(true) loop, checking for changes periodically…
mickzer
  • 5,958
  • 5
  • 34
  • 57
10
votes
1 answer

Can Websockets Work On Mobile Phones?

I'm currently thinking about creating a soft realtime mobile phone webapp, but when I started researching websockets, I found a load of scare stories about websocket connections dropping out on mobile phones: WebSockets over a 3G…
Charlie
  • 4,197
  • 5
  • 42
  • 59