rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Lakshan Perera <perera.lakshan@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: [ANN/RFC] LMGTWTY - Web Sockets for Rack+Rainbows!
Date: Mon, 14 Dec 2009 05:53:53 +0530	[thread overview]
Message-ID: <d44890b20912131623j3a91f1exc5b2cd212afd1535@mail.gmail.com> (raw)
In-Reply-To: <20091213205355.GB30229@dcvr.yhbt.net>


[-- Attachment #1.1: Type: text/plain, Size: 1232 bytes --]

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.

BTW, I found a small fix is needed to get this work correctly with Google
Chrome Beta. As described in Section 3.2
<http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-55#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.

--
Lakshan

On Mon, Dec 14, 2009 at 2:23 AM, Eric Wong <normalperson@yhbt.net> wrote:

> Eric Wong <normalperson@yhbt.net> wrote:
> > I've started getting Web Sockets going for Rainbows! (git version-only).
> >
> > If people like it, maybe this can be put into Rack itself (and it'll
> > have a better name and more exposure).
>
> I'm going to call it Sunshowers for now, the old name was too hard
> for other folks to remember.
>
> I'm going to make a release of both Rainbows!+Sunshowers later
> today, but the git versions should be ready to play with.
>
> --
> Eric Wong
>

[-- Attachment #1.2: Type: text/html, Size: 1749 bytes --]

[-- Attachment #2: resource_name_fix.diff --]
[-- Type: application/octet-stream, Size: 966 bytes --]

From 9465fc7b00e310e5e7fd85eebc8884a999234396 Mon Sep 17 00:00:00 2001
From: Lakshan <lakshan@web2media.net>
Date: Mon, 14 Dec 2009 05:01:07 +0530
Subject: [PATCH] append the resource name to ws_location 

---
 lib/sunshowers/web_socket.rb |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/sunshowers/web_socket.rb b/lib/sunshowers/web_socket.rb
index c9ceb8d..ad4bce4 100644
--- 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
+
     # returns the ws://... or wss://... URL
     def ws_location
       s = ws_scheme
@@ -65,6 +70,7 @@ module Sunshowers
       if (s == "wss" && port != 443) || (s == "ws" && port != 80)
         rv << ":#{port}"
       end
+      rv << ws_resource_name #concat the resource name
       rv
     end
 
-- 
1.6.5.2


  reply	other threads:[~2009-12-14  0:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 20:19 [ANN/RFC] LMGTWTY - Web Sockets for Rack+Rainbows! Eric Wong
2009-12-11 21:37 ` Eric Wong
2009-12-12  0:09   ` Daniel N
2009-12-13  9:09 ` Eric Wong
2009-12-13 20:53 ` Eric Wong
2009-12-14  0:23   ` Lakshan Perera [this message]
2009-12-14  0:51     ` Eric Wong
2009-12-14  0:57       ` Eric Wong
2009-12-14 10:41     ` James Tucker
2009-12-14 18:42       ` Eric Wong
2009-12-15  1:00         ` James Tucker
2009-12-15  4:37           ` Eric Wong
2009-12-15 11:15             ` James Tucker
2009-12-15 21:32               ` Eric Wong
2009-12-16 10:57                 ` James Tucker
2009-12-16 22:14                   ` Eric Wong
2009-12-17  3:23                     ` James Tucker
2009-12-17  8:47                       ` Eric Wong
2009-12-17 11:54                         ` James Tucker
2009-12-16 12:38                 ` James Tucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d44890b20912131623j3a91f1exc5b2cd212afd1535@mail.gmail.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).