@zerodensity/realityhub-api 1.9.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.
|
@@ -7,6 +7,8 @@ on:
|
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
publish-npm:
|
|
10
|
+
env:
|
|
11
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
10
12
|
name: Publish Job
|
|
11
13
|
runs-on: ubuntu-latest
|
|
12
14
|
steps:
|
|
@@ -17,6 +19,3 @@ jobs:
|
|
|
17
19
|
registry-url: https://registry.npmjs.org/
|
|
18
20
|
- run: npm ci
|
|
19
21
|
- run: npm publish
|
|
20
|
-
- run: npm publish --tag latest
|
|
21
|
-
env:
|
|
22
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
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
|
|
|
@@ -272,9 +283,9 @@ module.exports = class BrokerClient extends BrokerBase {
|
|
|
272
283
|
}
|
|
273
284
|
|
|
274
285
|
case 'subscribe': {
|
|
275
|
-
const
|
|
276
|
-
const eventName =
|
|
277
|
-
const targetModuleName =
|
|
286
|
+
const [vendor, moduleName, ...rest] = message.eventName.split('.');
|
|
287
|
+
const eventName = rest.join('.');
|
|
288
|
+
const targetModuleName = [vendor, moduleName].join('.');
|
|
278
289
|
|
|
279
290
|
if (this.moduleName === targetModuleName) {
|
|
280
291
|
this.emit('subscribe', { eventName });
|