@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.
@@ -19,4 +19,3 @@ jobs:
19
19
  registry-url: https://registry.npmjs.org/
20
20
  - run: npm ci
21
21
  - run: npm publish
22
- - run: npm publish --tag latest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodensity/realityhub-api",
3
- "version": "1.10.0",
3
+ "version": "1.14.0",
4
4
  "description": "RealityHub API Javascript Implementation",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -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.socket = new ws(webSocketURL);
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