Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to handle the situation of multiple target? #14

Open
lvbirui opened this issue Jan 20, 2021 · 3 comments
Open

how to handle the situation of multiple target? #14

lvbirui opened this issue Jan 20, 2021 · 3 comments

Comments

@lvbirui
Copy link

lvbirui commented Jan 20, 2021

is there any way to connect multiple target VNC server by this package?

@Craigzyc
Copy link
Contributor

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'
  });
}

@lvbirui
Copy link
Author

lvbirui commented Jan 21, 2021

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.

@Craigzyc
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants