@soundworks/core 3.5.1 → 3.7.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/AbstractPlugin.js +1 -1
- package/client/Client.js +16 -13
- package/client/PluginManager.js +39 -27
- package/client/Socket.js +17 -9
- package/common/ParameterBag.js +11 -13
- package/common/SharedState.js +48 -19
- package/common/SharedStateManagerServer.js +2 -2
- package/common/SharedStatePrivate.js +0 -2
- package/{server/utils → common}/logger.js +34 -6
- package/common/shared-state-utils.js +0 -1
- package/package.json +14 -3
- package/server/AbstractExperience.js +1 -1
- package/server/AbstractPlugin.js +7 -4
- package/server/Client.js +4 -4
- package/server/PluginManager.js +136 -40
- package/server/Server.js +293 -217
- package/server/Socket.js +9 -10
- package/server/Sockets.js +0 -1
package/server/Socket.js
CHANGED
|
@@ -7,14 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _socketsEncoderDecoder = require("../common/sockets-encoder-decoder.js");
|
|
9
9
|
|
|
10
|
-
const noop = () => {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const CLOSED = 3;
|
|
17
|
-
const READY_STATES = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
10
|
+
const noop = () => {}; // const CONNECTING = 0;
|
|
11
|
+
// const OPEN = 1;
|
|
12
|
+
// const CLOSING = 2;
|
|
13
|
+
// const CLOSED = 3;
|
|
14
|
+
// const READY_STATES = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
15
|
+
|
|
18
16
|
/**
|
|
19
17
|
* Simple wrapper with simple pubsub system built on top of `ws` sockets.
|
|
20
18
|
* The abstraction contains two different socket:
|
|
@@ -27,6 +25,7 @@ const READY_STATES = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
|
27
25
|
* @memberof server
|
|
28
26
|
*/
|
|
29
27
|
|
|
28
|
+
|
|
30
29
|
class Socket {
|
|
31
30
|
constructor(ws, binaryWs, rooms, sockets, options = {}) {
|
|
32
31
|
/**
|
|
@@ -115,7 +114,7 @@ class Socket {
|
|
|
115
114
|
this._isAlive = false;
|
|
116
115
|
this.ws.ping(noop);
|
|
117
116
|
}, this.config.pingInterval);
|
|
118
|
-
this.ws.addListener('error',
|
|
117
|
+
this.ws.addListener('error', _err => {// console.log(this.clientId, err);
|
|
119
118
|
});
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
@@ -128,7 +127,7 @@ class Socket {
|
|
|
128
127
|
terminate() {
|
|
129
128
|
clearInterval(this._intervalId); // clean rooms
|
|
130
129
|
|
|
131
|
-
for (let [
|
|
130
|
+
for (let [_key, room] of this.rooms) {
|
|
132
131
|
room.delete(this);
|
|
133
132
|
} // clear references to sockets and rooms
|
|
134
133
|
|