From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Long Polling Date: Mon, 7 Dec 2009 12:02:34 -0800 Message-ID: <20091207200234.GA26894@dcvr.yhbt.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1260216236 15466 80.91.229.12 (7 Dec 2009 20:03:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Dec 2009 20:03:56 +0000 (UTC) To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Mon Dec 07 21:03:48 2009 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:35 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NHjoC-0005Tj-2m for gclrrg-rainbows-talk@m.gmane.org; Mon, 07 Dec 2009 21:03:48 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id ACD291858282; Mon, 7 Dec 2009 15:03:47 -0500 (EST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id EABFC1858282 for ; Mon, 7 Dec 2009 15:02:41 -0500 (EST) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id 49BFE1FA97; Mon, 7 Dec 2009 20:02:41 +0000 (UTC) Alexander wrote: > Please, could anybody explain how to create simple long polling app > with rainbows? Hi Alexander, I'm not sure if anybody has actually written one for Rainbows!, but I think they usually include sleeping or using async.callback like async_sinatra[1]. For the concurrency models that appear synchronous, you can check out t/sleep.ru in the test cases for sleep examples: (case env['rainbows.model'] when :FiberPool, :FiberSpawn Rainbows::Fiber when :Revactor Actor else # :ThreadPool, :ThreadSpawn Kernel end).sleep(nr) I may put that logic into a env["async.sleep"] callback in places where env["async.callback"] is not available so the synchronous-looking concurrency models can all share the same code. If you're using EventMachine, NeverBlock (and in future versions: Rev, RevThreadSpawn, RevThreadPool, EventMachineDefer, EventMachineThreadSpawn), you can use "async.callback" or just use async_synatra which uses "async.callback" internally. [1] http://github.com/raggi/async_sinatra -- Eric Wong _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying