long-polling

Non-Message Queue / Simple Long-Polling in Python (and Flask)

白昼怎懂夜的黑 提交于 2019-12-02 14:41:59
I am looking for a simple (i.e., not one that requires me to setup a separate server to handle a messaging queue) way to do long-polling for a small web-interface that runs calculations and produces a graph. This is what my web-interface needs to do: User requests a graph/data in a web-interface Server runs some calculations. While the server is running calculations, a small container is updated (likely via AJAX/jQuery) with the calculation progress (similar to what you'd do in a consol with print (i.e. print 'calculating density function...')) Calculation finishes and graph is shown to user.

Receive Android GCM messages so slow?

可紊 提交于 2019-12-02 13:26:47
问题 Google Cloud Messaging (Push message) problem. I have two smartphones(HTC Sensation XE, Desire HD) and a tablet(Samsung Galaxy Note 10.1 Wifi). Sometimes I need to wait for almost 15 minutes to receive the GCM push messages. Sometimes I receive the GCM push messages immediately(within 30 secs). Is it normal? Or just because I'm under Wifi connected? If it is normal, are there any other services like "long-polling" I can use for retrieving messages from server? I'm currently using GCM+Polling

Receive Android GCM messages so slow?

徘徊边缘 提交于 2019-12-02 07:17:37
Google Cloud Messaging (Push message) problem. I have two smartphones(HTC Sensation XE, Desire HD) and a tablet(Samsung Galaxy Note 10.1 Wifi). Sometimes I need to wait for almost 15 minutes to receive the GCM push messages. Sometimes I receive the GCM push messages immediately(within 30 secs). Is it normal? Or just because I'm under Wifi connected? If it is normal, are there any other services like "long-polling" I can use for retrieving messages from server? I'm currently using GCM+Polling(AlarmManager) to retrieve messages from remote server. Any suggestions or better ideas? Below is my

Does Servlet return response after doGet method has finished?

与世无争的帅哥 提交于 2019-12-02 03:51:00
问题 Obviously, the doGet method has a return type of void, so, it doesn't return anything. In this sense, I'm using the word "return" to mean send the response back to the client that requested it. I'm trying to implement a long-polling Servlet. It would be beneficial for it not to send a response until I have something that I would like to send back. So, in the doGet method I add the connected user's ID and AsyncContext to a map: private ConcurrentMap<String, AsyncContext> contexts = new

How to change this ajax code to long polling [duplicate]

天大地大妈咪最大 提交于 2019-12-02 01:59:14
This question is an exact duplicate of: How to change from ajax polling to long polling [duplicate] This is my ajax code so please can anyone tell me how can i change this code to long polling ? Here is my code :- var chat = {} chat.fetchMessages = function () { $.ajax({ url: 'ajax/ajax/chat.php', type: 'POST', data: { method: 'fetch' }, success: function(data) { $('#chats').html(data); } }); } chat.interval = setInterval(chat.fetchMessages, 1000); You have to put the next call of fetchMessage in the callback of the previous one : var chat = {} chat.fetchMessages = function () { $.ajax({ url:

long-polling info from mysql not working

心不动则不痛 提交于 2019-12-02 01:41:12
I'm trying to make long-polling based chat with ajax, jquery, php and mysql, but something seems wrong (also i'm new to long-polling). index.php: <?php include 'db.php'; $result = mysql_query("SELECT id FROM chatpoll ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_array($result)) { $old_msg_id = $row['id']; } ?> <html> <head> <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var old_msg_id = <?php echo $old_msg_id; ?>; function waitForMsg(){ $.ajax({ type: "GET", url:

Does Servlet return response after doGet method has finished?

狂风中的少年 提交于 2019-12-02 00:57:55
Obviously, the doGet method has a return type of void, so, it doesn't return anything. In this sense, I'm using the word "return" to mean send the response back to the client that requested it. I'm trying to implement a long-polling Servlet. It would be beneficial for it not to send a response until I have something that I would like to send back. So, in the doGet method I add the connected user's ID and AsyncContext to a map: private ConcurrentMap<String, AsyncContext> contexts = new ConcurrentHashMap<>(); //...in the doGet method when I need to add the context... contexts.put(userId, context

jquery $.ajax request remains pending

随声附和 提交于 2019-12-01 14:44:50
I have made a simple chat application which uses long-polling approach using jquery, function sendchat(){ // this code sends the message $.ajax({ url: "send.php", async: true, data: { /* send inputbox1.value */ }, success: function(data) { } }); } function listen_for_message(){ // this code listens for message $.ajax({ url: "listen.php", async: true, timeout:5000, success: function(data) { // the message recievend so display that message and make new request for listening new messages $('#display').html(data); listen_for_message(); } }); } THIS SHOULD HAPPEN : after page loaded the infinite

Long-polling (user notification) with a RESTful architecture

Deadly 提交于 2019-12-01 14:15:30
I'm working on a simple RESTful api (on NodeJs). I understand that being restful implies that horizontal scaling will be much easier. Unfortunately, I need some way for clients to be notified of certain events almost instantly. For this reason, I was thinking of doing long-polling. The question I have is how this work with multiple servers. For instance, here's a simplified used case: Both servers A and B are behind a common load balancer. User Alice posts a message on Bob's wall (PUT request on server A). If Bob is online, he should be notified instantly (long-polling on server B). How can

jquery $.ajax request remains pending

荒凉一梦 提交于 2019-12-01 13:10:44
问题 I have made a simple chat application which uses long-polling approach using jquery, function sendchat(){ // this code sends the message $.ajax({ url: "send.php", async: true, data: { /* send inputbox1.value */ }, success: function(data) { } }); } function listen_for_message(){ // this code listens for message $.ajax({ url: "listen.php", async: true, timeout:5000, success: function(data) { // the message recievend so display that message and make new request for listening new messages $('