websocket advice

89 views
Skip to first unread message

Todd

unread,
Jul 1, 2011, 5:33:33 PM7/1/11
to Mojolicious
I was really excited to try websockets out with mojolicious. I set up
a Lite app chat server as found on the wiki, only to have my hopes
dashed by the incompatibility between Mojolicious' websocket protocol
and the one supported by current stable browsers. I understand that
this isn't anybody's fault, just the way it is with a new tech.

Since I'd like to embed a chat server like function in the Mojolicious
application I'm building that will be used in production, I asking for
advice on approaches. I can't mandate my users use unstable dev
versions of browsers and I'd prefer not to have to downgrade my
Mojolicious packages.

What is the possibility that Mojolicious could support two flavors of
websockets until the browsers catch up?

Should I punt on websockets and use some ajax polling or some other
"push" tech to implement my chat server?

Thanks for taking the time to read and I look forward to your
responses.

Todd

Sebastian Riedel

unread,
Jul 1, 2011, 5:48:35 PM7/1/11
to mojol...@googlegroups.com
I think we've had this discussion at least two times before. :)

Mojolicious could absolutely support draft 76 WebSockets too (already has in the past), *but* the implementation would have to be up to our quality standards.
That means great unit tests, clean code and no security holes. (draft 76 WebSockets are disabled in Firefox and Opera for security reasons atm.)

Now to get someone to invest that much time into something that will be removed again within a year won't be easy.
And even then you'll likely not be very happy with the result, since currently only Chrome and Safari have WebSockets enabled by default.

For production use i would highly recommend plain old Ajax and Comet, at least until ietf-09 WebSockets arrive in all major browsers later this year.

--
Sebastian Riedel
http://mojolicio.us
http://twitter.com/kraih
http://blog.kraih.com

> --
> You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com (mailto:mojol...@googlegroups.com).
> To unsubscribe from this group, send email to mojolicious...@googlegroups.com (mailto:mojolicious...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.


Sebastian Riedel

unread,
Jul 1, 2011, 5:54:36 PM7/1/11
to mojol...@googlegroups.com
Btw. If you're really determined to invest into a short term bridging project for realtime connectivity, maybe a socket.io plugin for Mojolicious wouldn't be such a bad idea.
That would at least give you some portability between the most commonly used browsers at the moment.


Am Freitag, 1. Juli 2011 um 23:33 schrieb Todd:

Todd

unread,
Jul 1, 2011, 6:17:19 PM7/1/11
to Mojolicious


On Jul 1, 3:48 pm, Sebastian Riedel <kra...@googlemail.com> wrote:
> I think we've had this discussion at least two times before. :)
>

Yes, that's how I learned that my test was never going to work. My
question was more along the lines of "OK its not going to work, what
are the chances that Mojo and Browsers will sync up in the timeframe
that I need for my project." Which I hear, loud and clear, is "not
very good." and in that case, what are some alternatives.

> Mojolicious could absolutely support draft 76 WebSockets too (already has in the past), *but* the implementation would have to be up to our quality standards.
> That means great unit tests, clean code and no security holes. (draft 76 WebSockets are disabled in Firefox and Opera for security reasons atm.)

Did the implementation from the past not live up to the standards? Is
that why it was removed (e.g. security issue)? (honest humble
inquiry, please don't misread the above as a challenge.)

>
> Now to get someone to invest that much time into something that will be removed again within a year won't be easy.
> And even then you'll likely not be very happy with the result, since currently only Chrome and Safari have WebSockets enabled by default.

I agree, doesn't make sense. Wasn't aware that Firefox had pulled
support, that kills the deal for me.

>
> For production use i would highly recommend plain old Ajax and Comet, at least until ietf-09 WebSockets arrive in all major browsers later this year.
>

Thanks, I'll start investigating.

Sebastian Riedel

unread,
Jul 1, 2011, 6:31:51 PM7/1/11
to mojol...@googlegroups.com

> Did the implementation from the past not live up to the standards? Is
> that why it was removed (e.g. security issue)? (honest humble
> inquiry, please don't misread the above as a challenge.)

We currently have support for both, server and client side WebSockets, that makes testing very straightforward as long as both use the same protocol version.
You would have to come up with a whole new test system to support multiple versions.

The biggest problem with draft 76 WebSockets however is the handshake, which unlike ietf-09 is not HTTP compatible, that means you can't reuse our current infrastructure and have to actually hack around it.
You basically would have to maintain a separate HTTP-ish parser that's not really HTTP, but directly exposed to the outside world. (a lot to go wrong...)

Reply all
Reply to author
Forward
0 new messages