comet

Finishing a HttpServletResponse but continue processing

余生颓废 提交于 2019-12-03 12:55:25
I have a situation that seems to fit the Async Servlet 3.0 / Comet situation but all I need to do is return a 200 response code (or other) after accepting the incoming parameters. Is there a way for a HttpServlet to complete the http request/response handshake and yet continue processing? Something like... doPost( req, response ) { // verify input params... response.setStatus( SC_OK ); response.close(); // execute long query } EDIT: Looking at the javax.servlet package - the proper phrasing to my question is How do I commit a response? as in Servlet.isCommitted() Here's how I've handled this

Server push: comet vs ape?

前提是你 提交于 2019-12-03 12:55:00
I've read a little about comet and also APE. Which one is better? I want the users to see other users updated content. Like Google Wave. And in comet, there are 2 versions: iframe vs traditional ajax. what is the difference and which is better. I dont quite understand it. Thanks. Comet is a set of techniques useful for developing realtime applications. You have two main implementations: streaming and long polling. In regular http requests the user sends the request to the server, receives the data (html, scrips, etc) and closes the connection - end of story. In streaming the connection is

How many child_processes should I fork() in node.js?

我的梦境 提交于 2019-12-03 12:18:40
My question is quite simple. though, it may require different variable to be answered (i guess) I'm playing around with node.js and I'm thinking of how to use it in a multi core architecture. Latest version provides child_process.fork() and child.spawn() methods for multi-process programming. I've read on this very good (but dated) article about using Node.js as a large-scale Comet server. Now then nodejs provides multi-process programming, I really have no idea about how many processes should I have to spawn for serving large number of request (assuming my server is running on just one

AJAX Polling Frequency - To long poll or not to long poll?

吃可爱长大的小学妹 提交于 2019-12-03 11:41:13
I'm building a component of a web page that needs relatively constant database polling. I can see two different approaches for this, and I'm wondering if one of them is better than the others, or if I'm missing a third option. 1) Send off an AJAX request every 1 or 2 seconds to check for updates. Each request returns immediately whether or not there is new data. 2) Fire off a single AJAX request that will not return until it receives data or a timeout occurs. Upon either of those happening, it fires off the next request. (I think this is called long polling?) The number of database queries

Polling, Comet, WebSockets, etc

混江龙づ霸主 提交于 2019-12-03 09:47:24
问题 I'm needing to build in some pretty agressive "auto refresh" capabilities into a web application. It's kind of a photo gallery and the images are stored on AmazonS3 but the data about the images are stored in our own database. I've played around with polling the server and sending ajax calls to get the updated data. I'm really concerned about the load on the server(s) with this method. At times, the page would need to be updated every 15 to 30 seconds. I've been reading on Comet and I'm just

how to trigger notification from other framework in atmosphere (comet)?

戏子无情 提交于 2019-12-03 09:11:37
basically i have read some samples, but all are self contained in one servlet. such as: use doGet to establish the long polling connection, and then use doPost to trigger the event to notify all suspended connections. Here is my question: I have other web actions programming in spring mvc, in the spring mvc controller a user post a message via /message/post, how can I make this action to trigger the atmosphere handler to notify the suspended connections? But what about non web components (EJB, JMS, Akka/Scala Actor, etc.) or web component with different scope (another web application, another

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

孤人 提交于 2019-12-03 07:26:43
问题 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 ;) 回答1: For now, long polling is probably the best solution. Many big-name sites have long polling implementations, including Facebook, Google and eBay. Not everyone has Flash installed/enabled in their browsers. In the future Web Sockets might be able to do an easier job of it for us. Update: As

HTTP 笔记与总结(9)分块传输、持久链接 与 反向 ajax(comet / server push / 服务器推技术)

爷,独闯天下 提交于 2019-12-03 07:02:48
HTTP 笔记与总结(9)分块传输、持久链接 与 反向 ajax(comet / server push / 服务器推技术) 反向 ajax 又叫 comet / server push / 服务器推技术 应用范围:网页聊天服务器,例如新浪微博在线聊天、google mail 网页聊天 原理:一般而言,HTTP 协议的特点是,连接之后断开连接(服务器响应 Content-Length,收到了指定 Length 长度的内容时,也就断开了)。在 HTTP 1.1 协议中,允许不写 Content-Length,比如要发送的内容长度确实不知道,此时需要一个特殊的 Content-Type:chunked ,叫做分块传输,只有当服务器最后发送 0\r\n ,在表明服务器和客户端的此次连接彻底结束。 【例】 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <?php set_time_limit(0); //ob_start(); $pad = str_repeat ( ' ' , 4000); echo $pad , '<br />' ; ob_flush(); flush (); //把产生的内容立即发送给浏览器而不是等脚本结束再一起发送 $i = 1; while ( $i ++){ echo $pad , '<br>' ; echo $i , '<br>

Long Polling Options: Nginx, PHP, Node.js

安稳与你 提交于 2019-12-03 06:49:13
I'm designing a long-polling app to broadcast small changes very rapidly to, possibly, a large number of users. The app will run in tandem with a website running a fairly standard cms. They'll both be running on one server, and to begin with so will the database. I come very much from a LAMP environment and I'm definitely a developer and not a sys-admin. That said I'm not afraid to try out some new things. I've spent the day researching my options and I'm hoping people can answer some questions and give me some recommendations. I have narrowed it down to these: A. Apache and php for the

GWT and WebSocket / Push data from server to GWT client

一笑奈何 提交于 2019-12-03 06:39:18
Is there any good library which supports WebSockets and is compatible with GWT? Ideally, the library would support WebSockets as well as a fallback for browsers which don't support WebSocket, e.g. a comet-like approach or polling. I'm currently using GWT-Comet to push data from my server to my GWT web application. However, this library is a bit broken in some aspects and it seems it's not maintained actively anymore. Thus, I'm searching for an alternative. I found Atmosphere , which suits the needs stated in the question pretty good. It supports GWT, and also Websockets. Also, it supports many