I have a nodejs websocket server ruing in the cloud to which I can make a secured web socket coection from any location outside of corporate firewall. Now, how can I provide proxy information while creating a websocket coection from a resource behind corporate proxy (on-premise)? I am using this nodejs module from https://github.com/websockets/ws.
I get EHOSTUNREACH error when I execute following code. Please note there is no vpn coection between cloud resource and the on premise resource.
**var wss = new WebSocket('wss://cloudserver:443', {
rejectUnauthorized: false
});**
With a sample code like below, I am able to make http coection to cloud from a resource behind corporate proxy using proxy information , but can't figure out how to make it work with the web sockets.
**var Http = require('http');
var req = Http.request({
host: 'proxy',
port: 8080,
method: 'GET',
path: 'http://c.com/' // full URL as path
}, function (res) {
res.on('data', function (data) {
console.log(data.toString());
});
});
req.end()
**
I also looked at following http://blog.vanamco.com/proxy-requests-in-node-js/ and it seems to have what I need, but as I am new to nodejs I am somewhat lost here.
