long-polling

Optimizing long polling on a dedicated server

扶醉桌前 提交于 2019-12-14 04:20:02
问题 Right now, I am hosting a site on a dedicated server, 8 GB ram, Intel Xeon E3 1230 V3. I am using long polling techniques in order to display information which gets added into a database consistently. The problem is: so far, after around let's say 20 users come onto the site, it starts lagging and slowing down dramatically. I'm pretty sure the server is strong enough to handle way more people than that. Thus, I am not sure what exactly is the problem. Can long polling using Apache handle that

What is the best way to automatically reestablish long polling request?

半城伤御伤魂 提交于 2019-12-14 03:18:43
问题 I am working on a project using long polling , as the nginx server will response 504 Gateway Timeout after the connection established 1 minute or so, I write the error handling function in the $.ajax so that it can automatically reconnect to the server when it receives 504 error. But although I have done this, I don't know whether this is the best practice of long polling mechanism, and this will produce a lot of 504 in log. It seems not good enough, so how should I do it? 回答1: You should put

AJAX long polling not working with IE

匆匆过客 提交于 2019-12-14 02:44:04
问题 I seem to be having a problem with long polling and IE. This is my first foray into long polling, so I set up a simple test to see if I could make it work. It seems to behave just fine with FF and Chrome, but I'm getting different results with IE. First, here's some code: HTML/Javascript: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1

Create a web-based chat box using AJAX, PHP, and SQL Long Polling?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 12:44:38
问题 I'm creating an online chat box for me and my friends at college to use online. In the current configuration, the chat messages are stored in a plain text file on the host machine (mine) and are fetched via AJAX every second, however, sometimes it is slow and glitchy and doesn't always work. To send a message, it passes the message to a JavaScript function which passes the value to a PHP script, writing it to the file along with the user's unique color (stored in a local cookie). Here's the

From polling to long polling

一笑奈何 提交于 2019-12-13 08:50:23
问题 So I have a script that uses basic polling to show the total amount of records in the database in real time so nothing complicated so can any one give me an example of my code in a long polling structure. The reason why I ask this question because all the articles on google search gives me examples in jQuery I cant seem to find a plain JavaScript example that makes sense in my situation. This is a .gif screenshot of my code in action so you guys know what I mean in detail. This is my basic

Long-polling with Atmosphere issue with Servlet 2.5

谁说胖子不能爱 提交于 2019-12-13 06:35:01
问题 I'm testing a simple chat application which is using Atmosphere framework. When I connect to the application from two browsers everything works like chat should work with Tomcat 7.0 and Websockets protocol is used. When I downgrade to Tomcat 6.0. or when I use Weblogic 10.3.6 long-polling is used (as expected). With one browser chatting with itself everything works but when I open second browser both windows are disconnected. I set the log level to TRACE and it seems that Atmosphere is adding

JSON data if/else parse

筅森魡賤 提交于 2019-12-13 04:24:52
问题 I am doing some long polling (ajax) and I am looping the following portion of code.. There is code being executed above and below. This code is part of an internal messaging system. A certain portion of the page wil blink when a message arrives. If the user checks the message, it will remove the dash_notify from the JSON response, which needs to turn off the blinking. See below: if (data.dash_notify == '1') { var x = '#dash_notif_blink'; function blinking(x) { timer = setInterval(blink, 10);

Tornado long polling requests

江枫思渺然 提交于 2019-12-13 02:42:57
问题 Below is the most simple example of my issue: When a request is made it will print Request via GET <__main__.MainHandler object at 0x104041e10> and then the request will remain open. Good! However, when you make another request it does not call the MainHandler.get method until the first connection has finished. How can I get multiple requests into the get method while having them remain long-polling. I'm passing arguments with each request that will get different results from a pub/sub via

Long polling (pending request) for JSF

人盡茶涼 提交于 2019-12-13 02:37:00
问题 I need to implement long polling or pending request for a chatroom. I tried a4j:push, but it seems doesn't work like a real long polling approach (see the following discussion: https://community.jboss.org/message/16614). The question is: which alternatives do I have to realize long polling? I'm using JSF 1.2, JAVA EE 6 and RichFaces 3.3.2. Thaks in advance! 回答1: You need to use the a4j:poll component from RichFaces. The exadel live demo has a very nice sample and explains the main properties.

Using ajax long polling to update a response on my page from an external API

冷暖自知 提交于 2019-12-13 01:23:04
问题 I have the following ajax long polling script (function poll(){ $.ajax({ url: "<?php echo URL::to('/internal/v1/checkTxn'); ?>", success: function(data){ //Update your dashboard gauge console.log(data.status); //Data is getting logged if(data.status == 'success'){ //This condition is not being checked console.log('suucesful'); //Not coming } }, dataType: "json", complete: poll, timeout: 1000 }); })(); The backend PHP code is as follows if(isset($_POST['status']) && $_POST['status']){ $data =