@soundworks/core
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -64,2 +64,3 @@ "use strict"; | ||
client.transport.addListener(`${_sharedStateUtils.UPDATE_NOTIFICATION}-${id}-${this.remoteId}`, updates => { | ||
// cf. https://github.com/collective-soundworks/soundworks/issues/18 | ||
this._commit(updates); | ||
@@ -66,0 +67,0 @@ }); // --------------------------------------------- |
@@ -44,3 +44,2 @@ "use strict"; | ||
// --------------------------------------------- | ||
// @todo - ask for schema in request if not cached. | ||
@@ -47,0 +46,0 @@ this.client.transport.addListener(_sharedStateUtils.CREATE_RESPONSE, (reqId, stateId, remoteId, schemaName, schema, initValues) => { |
@@ -136,2 +136,3 @@ "use strict"; | ||
// several times to the same state. | ||
// i.e. same state -> several remote attach on the same node | ||
const remoteId = generateRemoteId.next().value; | ||
@@ -138,0 +139,0 @@ |
@@ -70,2 +70,14 @@ "use strict"; | ||
// order would be broken, | ||
// we need to handle cases where: | ||
// client state (client.id: 2) sends a request | ||
// server attached state (client.id: -1) spot a problem and overrides the value | ||
// we want the remote client (id: 2) to receive in the right order: | ||
// * 1. the value it requested, | ||
// * 2. the value overriden by the server-side attached state (id: -1) | ||
// this problem could be solved properly with a reducer system: | ||
// if (dirty) { | ||
// -> call (async) reducer | ||
// -> get values from reducer | ||
//. -> dispatch to everybody | ||
// } | ||
for (let [peerRemoteId, peer] of this._attachedClients.entries()) { | ||
@@ -76,10 +88,4 @@ // propagate notification to all other attached clients except server | ||
} | ||
} // handle case where: | ||
// client state (client.id: 2) sends a request | ||
// server attached state (client.id: -1) spot a problem and overrides the value | ||
// we want the remote client (id: 2) to receive in the right order: | ||
// * 1. the value it requested, | ||
// * 2. the value overriden by attached state -1 | ||
} | ||
if (client.id !== -1) { | ||
@@ -86,0 +92,0 @@ client.transport.emit(`${_sharedStateUtils.UPDATE_RESPONSE}-${this.id}-${remoteId}`, reqId, updated); |
{ | ||
"name": "@soundworks/core", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "full-stack javascript framework for distributed audio visual experiences on the web", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -231,8 +231,14 @@ "use strict"; | ||
send(channel, ...args) { | ||
const msg = (0, _socketsEncoderDecoder.packStringMessage)(channel, ...args); | ||
this.ws.send(msg, err => { | ||
if (err) { | ||
console.error('error sending msg:', channel, args, err); | ||
} | ||
}); | ||
const msg = (0, _socketsEncoderDecoder.packStringMessage)(channel, ...args); // 0 CONNECTING Socket has been created. The connection is not yet open. | ||
// 1 OPEN The connection is open and ready to communicate. | ||
// 2 CLOSING The connection is in the process of closing. | ||
// 3 CLOSED The connection is closed or couldn't be opened. | ||
if (this.ws.readyState === 1) { | ||
this.ws.send(msg, err => { | ||
if (err) { | ||
console.error('error sending msg:', channel, args, err); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -239,0 +245,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129479
3263