playsocketjs 1.0.10 → 1.0.11
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.
|
@@ -440,14 +440,12 @@ class PlaySocket {
|
|
|
440
440
|
updateStorageArray(key, operation, value, updateValue) {
|
|
441
441
|
// Send operation to server (no optimistic update – we can't guarantee that it is correct)
|
|
442
442
|
// If another client has sent an update to the server that is processed first, the end result will differ.
|
|
443
|
-
const timestamp = this.#getTimestamp();
|
|
444
443
|
this.#sendToServer({
|
|
445
444
|
type: 'room_storage_array_update',
|
|
446
445
|
key,
|
|
447
446
|
operation,
|
|
448
447
|
value,
|
|
449
|
-
updateValue
|
|
450
|
-
timestamp
|
|
448
|
+
updateValue
|
|
451
449
|
});
|
|
452
450
|
}
|
|
453
451
|
|
|
@@ -227,8 +227,8 @@ function requireServer () {
|
|
|
227
227
|
const updatedArray = this.#arrayUpdate(arrayRoom.storage, data.key, data.operation, data.value, data.updateValue);
|
|
228
228
|
if (JSON.stringify(arrayRoom.storage[data.key]) !== JSON.stringify(updatedArray)) {
|
|
229
229
|
arrayRoom.storage[data.key] = updatedArray;
|
|
230
|
-
arrayRoom.storageTimestamps[data.key] =
|
|
231
|
-
this.#syncRoomStorageKey(arrayRoom, data.key,
|
|
230
|
+
arrayRoom.storageTimestamps[data.key] = Date.now();
|
|
231
|
+
this.#syncRoomStorageKey(arrayRoom, data.key, Date.now());
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
break;
|