librelist archives

« back to archive

WebSockets and Mongrel2

WebSockets and Mongrel2

From:
Jonathan Chang
Date:
2010-10-04 @ 09:53
Hi,

I'm checking out Mongrel2 and I thought I'd have a go at making a websocket
handler using m2r ruby gem so that I can learn a little bit more about
Mongrel2. I've noticed that when I receive a WebSocket request from
Mongrel2, I'm missing the body which contains 8 bytes of the random token.
Is this a bug in Mongrel2, or should I be doing this a different way?

Thanks

Jono

-- 
Silverpond Pty Ltd

email: jonathan.chang@silverpond.com.au
mobile: +61 411 727 819
phone: +61 3 9008 5929
fax: +61 3 8621 8996
address:
    Level 10
        50 Market Street
    Melbourne VIC 3000
    Australia

Re: [mongrel2] WebSockets and Mongrel2

From:
Zed A. Shaw
Date:
2010-10-04 @ 13:23
On Mon, Oct 04, 2010 at 08:53:35PM +1100, Jonathan Chang wrote:
> Hi,
> 
> I'm checking out Mongrel2 and I thought I'd have a go at making a websocket
> handler using m2r ruby gem so that I can learn a little bit more about
> Mongrel2. I've noticed that when I receive a WebSocket request from
> Mongrel2, I'm missing the body which contains 8 bytes of the random token.
> Is this a bug in Mongrel2, or should I be doing this a different way?

It's a combination.  I'm currently fixing how we do IO to solve a few
buffering problems so you might be hitting that.  The code got into a
bad state last week and now I'm correcting it.

But, the websockets most likely can't be implemented using just a
straight handler, although they'd probably work from handler->client
just fine, just not the other direction.  The real solution involves a
bit of code I have to implement so that it's bidirectional.

So, hang out a tick, I'll get it working soon.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] WebSockets and Mongrel2

From:
Jonathan Chang
Date:
2010-10-04 @ 22:54
Thanks Zed, let me know when you're done, and I'll give the websockets thing
a go.

Jono

On Tue, Oct 5, 2010 at 12:23 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:

> On Mon, Oct 04, 2010 at 08:53:35PM +1100, Jonathan Chang wrote:
> > Hi,
> >
> > I'm checking out Mongrel2 and I thought I'd have a go at making a
> websocket
> > handler using m2r ruby gem so that I can learn a little bit more about
> > Mongrel2. I've noticed that when I receive a WebSocket request from
> > Mongrel2, I'm missing the body which contains 8 bytes of the random
> token.
> > Is this a bug in Mongrel2, or should I be doing this a different way?
>
> It's a combination.  I'm currently fixing how we do IO to solve a few
> buffering problems so you might be hitting that.  The code got into a
> bad state last week and now I'm correcting it.
>
> But, the websockets most likely can't be implemented using just a
> straight handler, although they'd probably work from handler->client
> just fine, just not the other direction.  The real solution involves a
> bit of code I have to implement so that it's bidirectional.
>
> So, hang out a tick, I'll get it working soon.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>



-- 
Silverpond Pty Ltd

email: jonathan.chang@silverpond.com.au
mobile: +61 411 727 819
phone: +61 3 9008 5929
fax: +61 3 8621 8996
address:
    Level 10
        50 Market Street
    Melbourne VIC 3000
    Australia