noVNC is an open source project that allows remote access to a target computer directly in the browser.
If accessing GitHub is slow, you can try replacing github.com with hub.fastgit.org in the following text.
Create a new node project#
# Create a new folder called novnc-server and navigate to it
cd novnc-server
# Initialize (press Enter for default settings)
npm init
Use websockify-js#
# Copy websockify.js from https://github.com/novnc/websockify-js/blob/master/websockify/websockify.js to the folder
# Install dependencies
yarn add ws optimist mime-types -S
Use noVNC#
# Clone noVNC or download the release from noVNC, here we clone directly
git clone https://github.com/novnc/noVNC.git
Start#
Add a start command in package.json.
The updated scripts section should look like this (5900 is the port set by the VNC server, 5901 is the port for external browser access):
{
"scripts": {
"start": "node websockify.js --web ./noVNC 5901 localhost:5900",
"test": "echo \"Error: no test specified\" && exit 1"
}
}
Run yarn start
to start.
You can also use pm2 for management (recommended), the processes.json file should be as follows:
{
"apps": [
{
"name": "noVNC",
"script": "websockify.js",
"args": "--web ./noVNC 5901 localhost:5900"
}
]
}
Run pm2 start processes.json
to start in the background.
Getting Started#
Access http://ip:5901/vnc.html from another computer.
Public Network Usage#
pierced, core.pub, pinggy.io, bore.pub are worth having, but the latency may not be ideal, so you need to test it yourself.