Welcome! Log In Create A New Profile

Advanced

Would like to implement WebSocket support

February 01, 2012 10:56PM
 Hi all!

I've implemented the WebSocket wire protocol as an incremental parser, making it
suitable for use in high-end asynchronous servers such as NGINX. The code is
open source (BSD-licenced) and available on GitHub[1]. I plan on using it to
tunnel other protocols (svn and git, in particular) over HTTP. I have a nice
setup that works well on the client side, but I'd like to integrate this with my
existing NGINX stack with includes virtual hosting and a bunch of other stuff (I
can't use another server directly unless I use a non-default port).

To the best of my understanding, NGINX has no support for WebSockets. The HTTP
proxy module does not support HTTP 1.1 and WebSockets are incompatible with both
SCGI and FastCGI because of the "Content-Length" problem (it is assumed to be 0
if unspecified).

I'd like to implement an NGINX module that specifically handles WebSockets so
that I can integrate my tunnel in my NGINX setup. I have absolutely no
experience with the NGINX source code, but I've found a nice guide on writing
NGINX modules[2]. After initial reading, I understand that I need to write an
Upstream (proxy) handler. Is this correct?

The HTTP proxy module has a scary note that says:

> Note that when using the HTTP Proxy Module (or even when using FastCGI), the
entire client request will be buffered in nginx before being passed on to the
backend proxied servers.

Is this a limitation cause by NGINX's architecture, or is this by design
(e.g. for validation of body against headers, etc.)?

The bigger problem, however, is that there is no standard interface to
application servers for this new WebSocket protocol. There is some
discussion[3] on an Apache enhancement request that basically proposes a
modification of CGI. Since CGI has already been demonstrated to be a
performance problem, I'm looking for an alternate solution, maybe something
closer to SCGI? Anyone have suggestions?

Thanks, André

[1]: https://github.com/AndreLouisCaron/cwebs
[2]: http://www.evanmiller.org/nginx-modules-guide.html [3]:
https://issues.apache.org/bugzilla/show_bug.cgi?id=47485#c13

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Would like to implement WebSocket support

acaron February 01, 2012 10:56PM

Re: Would like to implement WebSocket support

sv February 02, 2012 09:36AM

Re: Would like to implement WebSocket support

Alexandr Gomoliako February 02, 2012 12:38PM

Re: Would like to implement WebSocket support

crazedfred February 29, 2012 02:30PM

Re: Would like to implement WebSocket support

cyberchris May 18, 2012 05:15AM

Re: Would like to implement WebSocket support

Alexandr Gomoliako May 18, 2012 10:16AM

Re: Would like to implement WebSocket support

姚伟斌 May 20, 2012 10:48PM

Re: Would like to implement WebSocket support

zestsh June 04, 2012 02:31AM

Re: Would like to implement WebSocket support

zestsh June 04, 2012 04:33AM

Re: Would like to implement WebSocket support

zestsh March 15, 2013 11:19PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 112
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready