This works a bit differently than python websockify implementation
since the server either runs in HTTP or in HTTPS and both web and
websocket servers only support the same mode. Specifying the --cert
parameter activates encrypted HTTPS/WSS mode.
This version requires a patched version of einaros/ws that can be
found here: https://github.com/kanaka/ws You can use the patched
version like this:
cd websockify/other
git clone https://github.com/kanaka/ws
npm link ./ws
Once the upstream 'ws' module supports subprotocol negotiation then
this will no longer be necessary.
Changes:
- Adds support for binary data and subprotocol negotiation of 'base64'
vs 'binary' with 'binary' preferred if the client offers it.
- Add client address to log messages.
- Close the target when the client closes.
- Catch errors when we try and send to a client that is no longer
connected.