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,gmane.comp.lang.ruby.general Subject: [ANN] Sunshowers - Web Sockets for Ruby, Rack+Rainbows! Date: Sun, 13 Dec 2009 23:43:20 +0000 Message-ID: <20091213234320.GB374@dcvr.yhbt.net> 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 1260747820 10932 80.91.229.12 (13 Dec 2009 23:43:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Dec 2009 23:43:40 +0000 (UTC) Cc: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org To: sunshowers-TBHja+091Wbby3iVrkZq2A@public.gmane.org, ruby-talk Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Mon Dec 14 00:43:33 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 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:51 gmane.comp.lang.ruby.general:309875 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NJy5z-0004qW-AE for gclrrg-rainbows-talk@m.gmane.org; Mon, 14 Dec 2009 00:43:23 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 3D5C31D78863; Sun, 13 Dec 2009 18:43:23 -0500 (EST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 6FBD21D78863 for ; Sun, 13 Dec 2009 18:43:21 -0500 (EST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPSA id E816C1F4EF; Sun, 13 Dec 2009 23:43:20 +0000 (UTC) Sunshowers is a Ruby library for Web Sockets. It exposes an easy-to-use API that may be used in both clients and servers. On the server side, it is designed to work with Rack::Request and Rainbows! concurrency models that expose a synchronous application flow. On the client side, it may be used as a standalone wrapper for IO-like objects. * http://rainbows.rubyforge.org/sunshowers/ * sunshowers-TBHja+091Wbby3iVrkZq2A@public.gmane.org * git://git.bogomips.org/sunshowers.git It appears works well with the echo_client.py example shipped with pywebsocket. It has not been tested against normal web browsers, though there's no reason it shouldn't work. == Features * supports reads and writes of both UTF-8 and binary Web Socket frames * compatible with Revactor, Rainbows::Fiber::IO and core Ruby IO objects * pure Ruby implementation, should be highly portable, tested under 1.9 == Install You may download the tarball from the Rainbows! project page on Rubyforge and run setup.rb after unpacking it: http://rubyforge.org/frs/?group_id=8977 You may also install it via RubyGems on Gemcutter: gem install sunshowers == Usage Make sure you're using one of the following concurrency models for Rainbows!: * FiberSpawn * FiberPool * Revactor * ThreadSpawn * ThreadPool # A simple echo server example require "sunshowers" use Rack::ContentLength use Rack::ContentType run lambda { |env| req = Sunshowers::Request.new(env) if req.ws? req.ws_handshake! ws_io = req.ws_io ws_io.each do |record| ws_io.write(record) break if record == "Goodbye" end req.ws_quit! # Rainbows! should handle this quietly end [404, {}, []] } Already using a Rack::Request-derived class? Sunshowers::WebSocket may also be included in any Rack::Request-derived class, so you can just open it up and include it: class Sinatra::Request < Rack::Request include Sunshowers::WebSocket end See the examples/ directory in the source tree for a client example. -- 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