From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.142.191.1 with SMTP id o1cs72406wff; Sun, 13 Dec 2009 16:51:20 -0800 (PST) Received: from mr.google.com ([10.90.7.11]) by 10.90.7.11 with SMTP id 11mr6825503agg.34.1260751880373 (num_hops = 1); Sun, 13 Dec 2009 16:51:20 -0800 (PST) Received: by 10.90.7.11 with SMTP id 11mr980589agg.34.1260751878992; Sun, 13 Dec 2009 16:51:18 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.204.16.73 with SMTP id n9ls886772bka.3.p; Sun, 13 Dec 2009 16:51:17 -0800 (PST) Received: by 10.204.10.8 with SMTP id n8mr123908bkn.5.1260751877041; Sun, 13 Dec 2009 16:51:17 -0800 (PST) Received: by 10.204.10.8 with SMTP id n8mr123907bkn.5.1260751877019; Sun, 13 Dec 2009 16:51:17 -0800 (PST) Return-Path: Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by gmr-mx.google.com with ESMTP id 11si245411bwz.3.2009.12.13.16.51.16; Sun, 13 Dec 2009 16:51:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of normalperson@yhbt.net designates 64.71.152.64 as permitted sender) client-ip=64.71.152.64; Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id D0C251F4F9; Mon, 14 Dec 2009 00:51:15 +0000 (UTC) Date: Sun, 13 Dec 2009 16:51:15 -0800 From: Eric Wong To: rack-devel@googlegroups.com Subject: Re: [ANN/RFC] LMGTWTY - Web Sockets for Rack+Rainbows! Message-ID: <20091214005115.GA20471@dcvr.yhbt.net> References: <20091211201958.GD2121@dcvr.yhbt.net> <20091213205355.GB30229@dcvr.yhbt.net> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of normalperson@yhbt.net designates 64.71.152.64 as permitted sender) smtp.mail=normalperson@yhbt.net X-Original-Sender: normalperson@yhbt.net Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rack-devel/t/1214d460ed982748 X-Message-Url: http://groups.google.com/group/rack-devel/msg/3bb892fb2e145651 Sender: rack-devel@googlegroups.com List-Unsubscribe: , List-Subscribe: , Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Lakshan Perera wrote: > Hi Eric, > > This is awesome! Thanks for coming up something like this, in a short period > of time. > I hope this would be part of Rack, which would enable all Ruby Frameworks to > work effortlessly with WebSockets. Yes, agreed, but the other thing is that Sunshowers can also be used for clients (without needing extra code), so the gem doesn't depend on Rack nor Rainbows! at the moment. > BTW, I found a small fix is needed to get this work correctly with Google > Chrome Beta. As described in Section 3.2 > in > IETF's "The Web Socket protocol" resource name(uri) needs to be appended > when constructing the WebSocket URLs. This needs to be adhered in the > WebSocket-Location value of the handshake header. > > I have attached a patch which fulfills this requirement. --- a/lib/sunshowers/web_socket.rb +++ b/lib/sunshowers/web_socket.rb @@ -58,6 +58,11 @@ module Sunshowers protocol end + # returns the requested resource name + def ws_resource_name + @env["REQUEST_URI"] + end Thanks Lackshan! But shouldn't it be (our good friend) PATH_INFO instead of REQUEST_URI? REQUEST_URI is both: a) not required by Rack b) includes QUERY_STRING -- Eric Wong