node-websockify
node-websockify copied to clipboard
how to handle the situation of multiple target?
is there any way to connect multiple target VNC server by this package?
Each listener would need a dedicated port but multiple instances of websockify could be created within one node instance.
I haven't tested this at all, but something like this should work
var websockify = require('@maximegris/node-websockify');
var vncServers = [
{
ip:'192.168.0.2',
vncPort: 5901,
nodePort: 5901
},
{
ip:'192.168.0.2',
vncPort: 5901,
nodePort: 5902
}
]
var vncWebsockifies = []
for (var i = 0; i < vncServers.length; i++) {
vncWebsockifies[i] = websockify({
source: '127.0.0.1:' + vncServers[i].nodePort,
target: vncServers[i].ip + ':' + vncServers[i].vncPort,
web : './directory',
cert: 'certSSL',
key: 'certSSL-key'
});
}
Each listener would need a dedicated port but multiple instances of websockify could be created within one node instance.
I haven't tested this at all, but something like this should work
var websockify = require('@maximegris/node-websockify'); var vncServers = [ { ip:'192.168.0.2', vncPort: 5901, nodePort: 5901 }, { ip:'192.168.0.2', vncPort: 5901, nodePort: 5902 } ] var vncWebsockifies = [] for (var i = 0; i < vncServers.length; i++) { vncWebsockifies[i] = websockify({ source: '127.0.0.1:' + vncServers[i].nodePort, target: vncServers[i].ip + ':' + vncServers[i].vncPort, web : './directory', cert: 'certSSL', key: 'certSSL-key' }); }
It kindly wrong , i had tested. websokify is just one object,can not handle two adress.
@lvbirui See the answer in the other similar issue. You are correct. You actually need to do a require for each instance by the looks of it