1.0.10 • Published 2 years ago

@maddeveloper/node-websockify v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

WebSocket-to-TCP proxy/bridge in NodeJS (forked & inspired by https://github.com/novnc/websockify)

License

Node-websockify is a WebSocket-to-TCP proxy/bridge you can use in a NodeJS program.

As said it is inspired of the javascript library of https://github.com/novnc/websockify. Unfortunately this library can't be used directly in a nodeJS program. Thats the reason why I created this project.

Usage

Import this module in your project

npm install --save @maddeveloper/node-websockify

Require the module and call the main function in your program code

import websockify from "@maddeveloper/node-websockify"

const [webServer, wsServer, error] = websockify({
  source: "url:port",
  target: "url:port",
  web: "./directory",
  cert: "certSSL",
  key: "certSSL-key",
})

Example :

import websockify from "@maddeveloper/node-websockify"

const [webServer, wsServer, error] = websockify({
  source: "127.0.0.1:8080",
  target: "192.168.0.100:5900",
})

Params

NameDescriptionDefault
sourceURL of websocket Servernull
targetURL of the VNC Servernull
webDirectory of static sources exposed by the servernull (optional)
certPath of the SSL certificatenull (optional)
keyKey of the SSL certificatenull (optional)
serverHTTP server to usenull (optional)
webSocketServerWebSocket server to usenull (optional)

Options

NameDescriptionDefault
onConnectedCalled when connection is established with targetundefined
onDisconnectedCalled when connection is interruped with targetundefined

CLI usage

websockify [--web web_dir] [--cert cert.pem [--key key.pem]] [source_addr:]source_port target_addr:target_port