long-polling

How to implement long polling with socket.io?

巧了我就是萌 提交于 2020-01-04 07:47:14
问题 Currently, i have created an application in node.js to send notification to all client using socket.io with mysql. So any change in my mysql database will be notified to the multiply clients through socket.io instantly. The application work charm. The problem i'm facing is related to performance issue. My browser get the constant push notification from the server, which slows down the performance of my browser. I/Client need to get the notification only on the database change, rest of the

Long-polling android technology

一世执手 提交于 2020-01-01 07:23:32
问题 I have some easy question. Can I make long polling on java, using only AsyncTask? class makepolling extends AsyncTask<String, String, String> { String TAG = "AndroidPolling"; int CONNECTION_TIMEOUT = 900000; int mHeartbeat = 10000; int TIMEOUT_TOLERANCE = 5000; String mPushURL = "https://my_serv_adress/service"; @Override protected String doInBackground(String... arg0) { String result = null; DefaultHttpClient def = new DefaultHttpClient(); HttpParams httpParams = def.getParams();

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

主宰稳场 提交于 2019-12-31 03:21:27
问题 This question already exists : How to change from ajax polling to long polling [duplicate] Closed 6 years ago . 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); 回答1: You have to put the next

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

血红的双手。 提交于 2019-12-31 03:21:11
问题 This question already exists : How to change from ajax polling to long polling [duplicate] Closed 6 years ago . 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); 回答1: You have to put the next

jsonp comet hanging request causes ugly “loading” status on browsers

此生再无相见时 提交于 2019-12-30 05:25:10
问题 I'm using jsonp to do cross-domain comet requests, and the "loading" status is really annoying. Is there any way to suppress this with javascript? For those who are unfamiliar with jsonp, it basically injects a script tag, except in my case, I'm hanging the request on my server without returning the request until a later time. During this time, browsers see my request as a "loading" state. I am using this: http://code.google.com/p/jquery-jsonp/ Thanks in advance! 回答1: As far as I know, there

Apache with Comet Support

让人想犯罪 __ 提交于 2019-12-29 09:24:46
问题 I'd like to build a multiplayer web game application in which it supports chat. I presume the application will have to handle hundreds of simultaneous connections. I'm planning to host my application in a shared web hosting, which has these limitations (most likely similar to PHP + Comet (long-polling) scaling / hosts): It does not seem I can change the web server. Most likely it's using Apache. Supports MySQL 5, PHP 5.3.x, Perl, Python, Ruby on Rails, CGI (To be more precise, I'll be using

SignalR LongPolling crashes with a little of stress

Deadly 提交于 2019-12-25 04:24:42
问题 I have a prototype that works well with SSE and WebSockets , but crashes when using LongPolling in the moment that I put a little bit of stress in the browser. My app can create games, and each game generate its own events, and those events must be sent to the browser. I have a button to create one, ten and a hundred games at once. Create each game requires a POST call to a WebAPI, so the x10 button creates 10 requests and x100 creates 100 requests to the server. When I use SSE or WS, it

Spring Long Polling with DeferredResult

我只是一个虾纸丫 提交于 2019-12-24 05:35:31
问题 I have a Spring MVC 3.2 application and i need to add a Long Polling to this Web service for a real time chat. I followed this article Spring MVC 3.2 Preview: Chat Sample. TopicRestController: private final Map<DeferredResult<String>, Long> chatRequests = new ConcurrentHashMap<DeferredResult<String>, Long>(); @RequestMapping(value="/{topicId}/updates" , method=RequestMethod.POST) public @ResponseBody DeferredResult<String> isNewTopic( @PathVariable Long topicId, Model model, HttpSession

AngularJs how to get data from a polling service to a controller

五迷三道 提交于 2019-12-23 17:54:32
问题 I have this service which checks if there a new data from the back end. It it working fine.But the problem is I cant get the data from the service to the controller using $watch nor using the promise . SERVICE .service('notificationPollService',function($q, $http, $timeout){ var notification={}; notification.poller = function(){ return $http.get('some/routes/') .then(function(response) { $timeout(notification.poller, 1000); if (typeof response.data === 'object') { return response.data; } else

Catching bottle server errors

放肆的年华 提交于 2019-12-23 12:20:15
问题 I am trying to get my bottle server so that when one person in a game logs out, everyone can immediately see it. As I am using long polling, there is a request open with all the users. The bit I am having trouble with is catching the exception that is thrown when the user leaves the page from the long polling that can no longer connect to the page. The error message is here. Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 438, in handle_one