Skip to content

Commit

Permalink
Issue-268: Websocket login respects https_proxy environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
weichuliu committed Nov 4, 2016
1 parent ce618b1 commit e0ccfc7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/clients/transports/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ var WebSocket = require('ws');
var wsTransport = function wsTransport(socketUrl, opts) {
var wsTransportOpts = opts || {};
var wsOpts = {};
var proxyURL = wsTransportOpts.proxyURL || process.env.https_proxy;

if (wsTransportOpts.proxyURL) {
wsOpts.agent = new HttpsProxyAgent(wsTransportOpts.proxyUrl);
if (proxyURL) {
console.log('Using https proxy: ' + proxyURL);
wsOpts.agent = new HttpsProxyAgent(proxyURL);
}

return new WebSocket(socketUrl, wsOpts);
Expand Down

0 comments on commit e0ccfc7

Please sign in to comment.