UNPKG

@atomist/automation-client

Version:

Atomist API for software low-level client

24 lines 899 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const HttpsProxyAgent = require("https-proxy-agent"); const WebSocket = require("ws"); const logger_1 = require("../../util/logger"); /** * WS based WebSocketFactory implementation */ class WSWebSocketFactory { create(registration) { return new WebSocket(registration.url, this.configureOptions({})); } configureOptions(options) { if (process.env.HTTPS_PROXY || process.env.https_proxy) { const proxy = process.env.HTTPS_PROXY || process.env.https_proxy; logger_1.logger.debug(`WebSocket connection using proxy '${proxy}'`); options.agent = new HttpsProxyAgent(proxy); } return options; } } exports.WSWebSocketFactory = WSWebSocketFactory; exports.DefaultWebSocketFactory = new WSWebSocketFactory(); //# sourceMappingURL=wsClient.js.map