[Solved] Web sockets

Added by rkiryanov almost 9 years ago


I am interested in web sockets. I found a web_socket module ( and wonder why it is still not available "out of the box". Could you please add support for web sockets as standard? If "no", is it possible to use mod_proxy to proxy web socket connections (I know about a HTTP handshake)?

Thank you.

Replies (12)

RE: Web sockets - Added by TauSudan almost 9 years ago

That mod_websocket is licensed under the GPLv3 which is incompatible with lighttpd's BSD license. So, it doesn't stand a chance of getting included. That person will either have to change the license or someone else will have to write a mod_websocket.

RE: Web sockets - Added by Max_nl over 8 years ago

<< That mod_websocket is licensed under the GPLv3 >>

Are you sure?
The "COPYING" file looks pretty much BSD to me:

Copyright (c) 2010, Norio Kobota
 All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

- Neither the name of the 'incremental' nor the names of its contributors may
  be used to endorse or promote products derived from this software without
  specific prior written permission.

RE: Web sockets - Added by stbuehler over 8 years ago

modifying core connection handling -> not gonna happen in 1.4.x.

RE: Web sockets - Added by skil over 8 years ago

i'm also requesting the inclusion of the module.
in other case 1 of lighttpd users (with many servers) will need to do more work with updating lighty/mod_websocket as long as they are maintained separately.

RE: Web sockets - Added by stbuehler over 8 years ago

read what i wrote. NOT GONNA HAPPEN IN 1.4.X

RE: Web sockets - Added by nori0428 over 8 years ago

Hello and Nice to meet you.
First of all, thank you for distributing lighttpd, great web server software.

I wrote and maintain mod_websocket for lighttpd just for my fun.
And I would like to fully compatible with lighttpd's licence.

The state machine in lighttpd, when returning to the core from a module in CON_STATE_READ,
client(browser) socket always will be closed.
Therefore, I have no choice other than to create a patch, sorry.

If there's any other way, I'm happy to get it.
And if not, I'm grad to support persistent socket for module in after version 1.5.


RE: Web sockets - Added by piloos over 4 years ago


Bumping up this question after 4 years.

Up until now, users which required a websocket proxy or a websocket-TCP proxy in lighttpd could use the module mod_websocket which is provided by nori0428 on github (thanks for that!).

Due to the buffer/chunck handling refactoring done in lighttpd 1.4.36, this module is not following the lighttpd development anymore.

This brings me back to the initial question of this thread: Are there any plans to support websocket proxying 'out-of-the-box' in lighttpd? Or do you stick with the statement '...not gonna happen in 1.4.x'


RE: Web sockets - Added by gstrauss over 4 years ago

No immediate plans, but also no longer off the table. Some changes are progressing which may make it more straightforward to integrate this or something similar in the future. Would you mind checking back in 2 months?

RE: Web sockets - Added by stbuehler over 4 years ago

I'm sorry, i still don't see any chance fdevents will become bidirectional in 1.4.

RE: Web sockets - Added by linxdev over 4 years ago

The one thing I would like to do is implement an inetd type module. I would need to write a client proxy to work work it.

The idea goes like this:

1. A "page" is defined in the config file for the module.
2. Client code connects HTTP and sends 'GET /that_special_page'
3. Module does a fork, exec on the program, passed FDs over, and then terminates.
4. Lighttpd no longer manages that process.

This moves from HTTP to raw sockets. On my clients I would write a daemon that would listen to port and then it would contact lighttpd, GET, and then shuffle bits between the FDs.

A preliminary look of the documentation on modules has me believing this idea may not be possible.

The primary goal is for TCP/IP and I'm sure this is exactly what WebSockets does.

RE: Web sockets - Added by gstrauss over 4 years ago

Please see

Also, a different mod_websocket implementation for lighttpd (mentioned at top):

YMMV. These modules probably need to be updated to work with the current version of lighttpd.
And there may be other mod_websocket implementations for lighttpd out there...

RE: Web sockets - Added by gstrauss almost 3 years ago

lighttpd 1.4.46 and later support websockets.
Docs_ModWStunnel provides a websocket tunnel through which client and a backend server can tunnel another protocol.
Docs_ModProxy proxies to a backend websocket server
Docs_ModCGI can run a backend CGI to act as websocket server for a request