comet

Android service with long living HttpConnection

谁说胖子不能爱 提交于 2020-01-13 06:38:15
问题 I am tring to develop a project that connects to a comet server with long living connections. i do this job in a service. But when android device goes to idle mode, the thread i started from service stops working and do not close connections or try a new connection. is there any method that i should use for this stuff. 回答1: Using PowerManager.WakeLock solved my problem. I know, it kills baterry usage but, i had to use a long living service. 来源: https://stackoverflow.com/questions/5505801

Keeping a jQuery .getJSON() connection open and waiting while in body of a page?

血红的双手。 提交于 2020-01-13 06:13:41
问题 I'm writing a basic push messaging system. A small change has caused it to stop workingly properly. Let me explain. In my original version, I was able to put the code in the of a document something like this: <head> ...text/javascript"> $(document).ready(function(){ $(document).ajaxStop(check4Updates); check4Updates(); }); function check4Updates(){ $.getJSON('%PATH%', callback); }; ... </head> This worked nicely and would keep the connection open even if the server return null (which it would

Keeping a jQuery .getJSON() connection open and waiting while in body of a page?

妖精的绣舞 提交于 2020-01-13 06:12:52
问题 I'm writing a basic push messaging system. A small change has caused it to stop workingly properly. Let me explain. In my original version, I was able to put the code in the of a document something like this: <head> ...text/javascript"> $(document).ready(function(){ $(document).ajaxStop(check4Updates); check4Updates(); }); function check4Updates(){ $.getJSON('%PATH%', callback); }; ... </head> This worked nicely and would keep the connection open even if the server return null (which it would

Django and Long Polling

喜你入骨 提交于 2020-01-12 07:34:09
问题 I need to implement long polling in my application to retrieve the events. But I have no idea how to do it. I know the concept of long polling, i.e to leave the connection open, until an event occurs. But how do I do implement this in my project. If you could give me a simple long polling example of client side and the views i guess, I would really appreciate. Thank you! 回答1: very simple example: import time def long_polling_view(request): for i in range(30): #e.g. reopen connection every 30

Flush problem with ajax

我的未来我决定 提交于 2020-01-11 03:57:11
问题 I used flush() function in infinite loop in my php page, it echoes a text each second. when i open the page in browser it works! but when i load it via jquery ajax it doesn't response! php page <?php if (ob_get_level() == 0) ob_start(); for ($i = 0; true/*$i<10*/; $i++){ echo "<br> Line to show. $i"; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(1); } ob_end_flush(); ?> jquery code $.ajax({ url: 'res.php', beforeSend: function( ) { $('#mydiv').html('loading...'); }, success: function

Does facebook use comet or ajax for its notifications?

强颜欢笑 提交于 2020-01-06 11:30:46
问题 Would facebook get notifications via comet push or an ajax script that checks for new notifications every second? and which is more efficient for such a system? 回答1: It looks more like comet to me, there is a GET request to ?.??.channel.facebook.com that takes 55 seconds to time out. This GET request repeats the entire time I have the page loaded - This is how long polling works. I'm using Chrome, it could use a different transport for another browser. If there were to be a notification, the

How to use comet (disable output buffering in nginx, it works in apache normally but not nginx)?

蓝咒 提交于 2020-01-05 07:08:10
问题 I have a comet-driven chat script in my site My Servers configuration is NGINX with PHP-FPM , I also have apache installed on different port. When I try to run the chat script on Apache and I do flood the buffer ( my output buffering size is 1 KB) when I flood it with 1024 character, it flushes automatically That's in apache. But in nginx it doesn't. My code is very similar to this <?php // this is to fill the buffer and start output; and it works on apache normally echo str_repeat(" ",1024);

.ashx cannot find type error on IIS7 , no problems on webdev server

对着背影说爱祢 提交于 2020-01-03 05:16:51
问题 I am trying to make AspNetComet.zip work on IIS7 (a simple comet chat implementation) Here is a portion of my web.config. <system.web> <httpHandlers> <add verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/> </httpHandlers> </system.web> <system.webServer> <handlers> <add name="DefaultChannelHandler" verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/> </handlers> </system.webServer> When I publish the website

tomcat or glassfish as comet server?

不打扰是莪最后的温柔 提交于 2020-01-01 00:43:30
问题 they are both free but i think glassfish has some limitation or when you reach up to a certain nr of users (comet) then you have to pay? is that correct? if true, could you use tomcat as a comet server? if not, then which free comet servers are there supporting long polling and iframe? 回答1: They are both free but i think glassfish has some limitation or when you reach up to a certain nr of users (comet) then you have to pay? is that correct? No, GlassFish doesn't have such limitation (where

Refused to set unsafe header “Origin” when using xmlHttpRequest of Google Chrome

人走茶凉 提交于 2019-12-31 12:36:20
问题 Got this error message: Refused to set unsafe header "Origin" Using this code: function getResponse() { document.getElementById("_receivedMsgLabel").innerHTML += "getResponse() called.<br/>"; if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", "http://L45723:1802", true, "server", "server123"); //must use L45723:1802 at work. receiveReq.onreadystatechange = handleReceiveMessage; receiveReq.setRequestHeader("Origin", "http://localhost/"); receiveReq