From: Eric Wong <normalperson@yhbt.net>
To: rack-devel@googlegroups.com
Subject: Re: [ANN/RFC] LMGTWTY - Web Sockets for Rack+Rainbows!
Date: Sun, 13 Dec 2009 09:09:41 +0000 [thread overview]
Message-ID: <20091213090941.GA19572@dcvr.yhbt.net> (raw)
In-Reply-To: <20091211201958.GD2121@dcvr.yhbt.net>
Eric Wong <normalperson@yhbt.net> wrote:
> For reading, Lmgtwty::IO#gets() returns a single web socket frame.
> So it removes the first and last bytes of (\x00 frame \xff)
Lmgtwty::IO#gets now also understands the binary framing format,
too. This does not appear to be generated by Chrome or pywebsocket,
but both understand it.
> For writing, Lmgtwty::IO#write(buf) - writes the contents of +buf+ to
> the client socket, transparently framing it with "\x00" and "\xff"
> bytes.
Lmgtwty::IO#write(buf) will now call either Lmgtwty::IO#write_utf8(buf)
or Lmgtwty::IO#write_binary(buf) depending on the encoding of +buf+
write(buf) will attempt to use write_utf8(buf) since that seems to be
the prevalent framing, under 1.9 just make sure +buf+ is of
Encoding::UTF_8.
> === Lmgtwty::Request is a subclass of Rack::Request
>
> It adds a few helper methods to handle handshaking and using
> Lmgtwty::IO.
I've moved all the logic into a Lmgtwty::WebSocket module, so
users of other Rack::Request subclasses (like Sinatra::Request)
can also get that stuff included as they wish.
> * iobuffer is a C extension gem dependency, I expect replacing it with
> a pure Ruby Array of Strings with minimal/no performance loss since
> the Strings are expected to be short anyways.
The iobuffer dependency is gone with no noticeable performance hit. If
you're writing valid UTF-8 (and encoding strings as such under 1.9),
then performance has actually improved now (especially if you use
write_utf8 directly).
> * I've only tested this with the python command-line client. I
> avoid GUIs as much as possible and using Chrome at this stage
> (without a Vimperator equivalent) would cause me too much pain.
At least now I've read the Chrome WebSockets code.
--
Eric Wong
next prev parent reply other threads:[~2009-12-13 9:09 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 [this message]
2009-12-13 20:53 ` Eric Wong
2009-12-14 0:23 ` Lakshan Perera
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=20091213090941.GA19572@dcvr.yhbt.net \
--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).