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 can i handle multiple connection, with different ip and different ports ? #15

Open
emulk opened this issue Jul 12, 2021 · 4 comments

Comments

@emulk
Copy link

emulk commented Jul 12, 2021

I need to handel the connection on different servers, is possible to open different connection, with like 5 different servers, like:

websockifyMaker({
source: '127.0.0.1:8081',
target: 'remoteServerIp:5901'
}, {
source: '127.0.0.1:8082',
target: 'remoteServerIp:5902'
}, {
source: '127.0.0.1:8083',
target: 'remoteServerIp:5903'
}

);

Thank you

@Craigzyc
Copy link
Contributor

You can just make multiple instances

let websockify = []
websockify[0] = require('@maximegris/node-websockify');
websockify[1] = require('@maximegris/node-websockify');
websockify[2] = require('@maximegris/node-websockify');

websockify[0]({
    source: '127.0.0.1:8081',
    target: 'remoteServerIp:5901'
});

websockify[1]({
    source: '127.0.0.1:8082',
    target: 'remoteServerIp:5902'
});

websockify[2]({
    source: '127.0.0.1:8083',
    target: 'remoteServerIp:5903'
});

@sukkamehu
Copy link

@emulk https://github.com/sukkamehu/node-multi-websockify Just moment ago I created probably something which you could utilize?

@mirkoboggian
Copy link

You can just make multiple instances

let websockify = []
websockify[0] = require('@maximegris/node-websockify');
websockify[1] = require('@maximegris/node-websockify');
websockify[2] = require('@maximegris/node-websockify');

websockify[0]({
    source: '127.0.0.1:8081',
    target: 'remoteServerIp:5901'
});

websockify[1]({
    source: '127.0.0.1:8082',
    target: 'remoteServerIp:5902'
});

websockify[2]({
    source: '127.0.0.1:8083',
    target: 'remoteServerIp:5903'
});

Hi, it doens't work.

`WebSocket settings:
- proxying from 127.0.0.1:8001 to 10.233.0.89:5900
- Running in unencrypted HTTP (ws://) mode
no callbacks
WebSocket settings:
- proxying from 127.0.0.1:8002 to 10.233.0.104:5900
- Running in unencrypted HTTP (ws://) mode
C:\Websockify\node_modules\ws\lib\websocket-server.js:83
throw new Error(
^

Error: The HTTP/S server is already being used by another WebSocket server
at new WebSocketServer (C:\Websockify\node_modules\ws\lib\websocket-server.js:83:15)
at Server. (C:\Websockify\node_modules@maximegris\node-websockify\websockify.js:199:14)
at Object.onceWrapper (node:events:628:28)
at Server.emit (node:events:526:35)
at emitListeningNT (node:net:1785:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

Node.js v18.17.1`

@mirkoboggian
Copy link

I need to handel the connection on different servers, is possible to open different connection, with like 5 different servers, like:

websockifyMaker({ source: '127.0.0.1:8081', target: 'remoteServerIp:5901' }, { source: '127.0.0.1:8082', target: 'remoteServerIp:5902' }, { source: '127.0.0.1:8083', target: 'remoteServerIp:5903' }

);

Thank you

did you solve?

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

4 participants