@zerodensity/realityhub-api 1.10.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/lib/BrokerClient.js
CHANGED
|
@@ -62,6 +62,7 @@ module.exports = class BrokerClient extends BrokerBase {
|
|
|
62
62
|
|
|
63
63
|
this.isDuplicate = params.isDuplicate;
|
|
64
64
|
this.parent = params.parent;
|
|
65
|
+
this.ssl = params.ssl;
|
|
65
66
|
this.duplicates = new Set();
|
|
66
67
|
|
|
67
68
|
// moduleName of the server (will be set when we receive a ping message)
|
|
@@ -125,13 +126,23 @@ module.exports = class BrokerClient extends BrokerBase {
|
|
|
125
126
|
url = { hostname: options.host, port: options.port };
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
const scheme = url.protocol === 'https:' ? 'wss' : 'ws';
|
|
129
|
+
const scheme = (url.protocol === 'https:' || this.ssl) ? 'wss' : 'ws';
|
|
129
130
|
|
|
130
131
|
const webSocketURL = url.port
|
|
131
132
|
? `${scheme}://${url.hostname}:${url.port}${this.webSocketURL}`
|
|
132
133
|
: `${scheme}://${url.hostname}${this.webSocketURL}`;
|
|
133
134
|
|
|
134
|
-
this.
|
|
135
|
+
this.logger.info(`BrokerClient is connecting to ${webSocketURL}`);
|
|
136
|
+
|
|
137
|
+
if (typeof process !== "undefined" && process.versions != null && process.versions.node != null) {
|
|
138
|
+
const NODE_TLS_REJECT_UNAUTHORIZED = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
|
139
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
|
|
140
|
+
this.socket = new ws(webSocketURL);
|
|
141
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = NODE_TLS_REJECT_UNAUTHORIZED;
|
|
142
|
+
} else {
|
|
143
|
+
this.socket = new ws(webSocketURL);
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
this.addSocketListeners();
|
|
136
147
|
}
|
|
137
148
|
|