@soundworks/core 3.3.3 → 3.5.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/client/Client.js +4 -0
- package/client/Socket.js +9 -0
- package/package.json +1 -1
- package/server/Server.js +6 -2
- package/server/utils/logger.js +34 -0
package/client/Client.js
CHANGED
package/client/Socket.js
CHANGED
|
@@ -315,6 +315,15 @@ class Socket {
|
|
|
315
315
|
removeAllBinaryListeners(channel) {
|
|
316
316
|
this._removeAllListeners(this._binaryListeners, channel);
|
|
317
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Immediately close the 2 sockets
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
terminate() {
|
|
324
|
+
this.ws.close();
|
|
325
|
+
this.binaryWs.close();
|
|
326
|
+
}
|
|
318
327
|
|
|
319
328
|
}
|
|
320
329
|
|
package/package.json
CHANGED
package/server/Server.js
CHANGED
|
@@ -238,13 +238,16 @@ class Server {
|
|
|
238
238
|
pingInterval: 5000
|
|
239
239
|
},
|
|
240
240
|
useHttps: false,
|
|
241
|
-
crossOriginIsolated: true
|
|
241
|
+
crossOriginIsolated: true,
|
|
242
|
+
verbose: true
|
|
242
243
|
},
|
|
243
244
|
app: {
|
|
244
245
|
name: 'soundworks'
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
|
-
this.config = (0, _lodash.default)({}, defaultConfig, config);
|
|
248
|
+
this.config = (0, _lodash.default)({}, defaultConfig, config);
|
|
249
|
+
|
|
250
|
+
_logger.default.configure(this.config.env.verbose); // @note: do not remove
|
|
248
251
|
// backward compatibility w/ assetsDomain and `soundworks-template`
|
|
249
252
|
// cf. https://github.com/collective-soundworks/soundworks/issues/35
|
|
250
253
|
// see also '@soundworks/plugin-audio-buffer-loader' (could be updated more
|
|
@@ -255,6 +258,7 @@ class Server {
|
|
|
255
258
|
// + new template
|
|
256
259
|
// @note: keep `websocket.path` as defined should be enough
|
|
257
260
|
|
|
261
|
+
|
|
258
262
|
if (!this.config.env.assetsDomain && this.config.env.subpath !== undefined) {
|
|
259
263
|
const subpath = this.config.env.subpath.replace(/^\//, '').replace(/\/$/, '');
|
|
260
264
|
|
package/server/utils/logger.js
CHANGED
|
@@ -15,11 +15,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* @private
|
|
16
16
|
*/
|
|
17
17
|
const logger = {
|
|
18
|
+
verbose: true,
|
|
19
|
+
|
|
20
|
+
configure(verbose) {
|
|
21
|
+
this.verbose = verbose;
|
|
22
|
+
},
|
|
23
|
+
|
|
18
24
|
title(msg) {
|
|
25
|
+
if (!this.verbose) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
console.log(_chalk.default.cyan(`+ ${msg}`));
|
|
20
30
|
},
|
|
21
31
|
|
|
22
32
|
clientConfigAndRouting(routes, config) {
|
|
33
|
+
if (!this.verbose) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
const clientsConfig = config.app.clients;
|
|
24
38
|
const serverIp = config.env.serverIp;
|
|
25
39
|
const auth = config.env.auth;
|
|
@@ -76,22 +90,42 @@ const logger = {
|
|
|
76
90
|
},
|
|
77
91
|
|
|
78
92
|
ip(protocol, address, port) {
|
|
93
|
+
if (!this.verbose) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
console.log(` ${protocol}://${address}:${_chalk.default.green(port)}`);
|
|
80
98
|
},
|
|
81
99
|
|
|
82
100
|
pluginStart(name) {
|
|
101
|
+
if (!this.verbose) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
83
105
|
console.log(` ${name} ${_chalk.default.yellow('start...')}`);
|
|
84
106
|
},
|
|
85
107
|
|
|
86
108
|
pluginStarted(name) {
|
|
109
|
+
if (!this.verbose) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
87
113
|
console.log(` ${name} ${_chalk.default.cyan('started')}`);
|
|
88
114
|
},
|
|
89
115
|
|
|
90
116
|
pluginReady(name) {
|
|
117
|
+
if (!this.verbose) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
91
121
|
console.log(` ${name} ${_chalk.default.green('ready')}`);
|
|
92
122
|
},
|
|
93
123
|
|
|
94
124
|
pluginErrored(name) {
|
|
125
|
+
if (!this.verbose) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
95
129
|
console.log(` ${name} ${_chalk.default.red('errors')}`);
|
|
96
130
|
}
|
|
97
131
|
|