playsocketjs 1.2.0 → 1.2.2
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.
|
@@ -1708,12 +1708,10 @@ function requireCrdtManager () {
|
|
|
1708
1708
|
|
|
1709
1709
|
/**
|
|
1710
1710
|
* Create a new instance
|
|
1711
|
-
* @param {string} replicaId - Choose a uuid (falls back to random uuid)
|
|
1712
1711
|
*/
|
|
1713
|
-
constructor(
|
|
1714
|
-
if (!replicaId) return console.error("No replicaId provided!");
|
|
1712
|
+
constructor(debug) {
|
|
1715
1713
|
if (debug) this.#debug = true;
|
|
1716
|
-
this.#replicaId =
|
|
1714
|
+
this.#replicaId = crypto.randomUUID();
|
|
1717
1715
|
this.#vectorClock.set(this.#replicaId, 0);
|
|
1718
1716
|
}
|
|
1719
1717
|
|
|
@@ -2096,7 +2094,7 @@ class PlaySocket {
|
|
|
2096
2094
|
if (options.endpoint) this.#endpoint = options.endpoint;
|
|
2097
2095
|
if (options.customData) this.#customData = { ...options.customData };
|
|
2098
2096
|
if (options.debug) this.#debug = true; // Enabling extra logging
|
|
2099
|
-
this.#crdtManager = new crdtManagerExports.CRDTManager(this.#
|
|
2097
|
+
this.#crdtManager = new crdtManagerExports.CRDTManager(this.#debug);
|
|
2100
2098
|
}
|
|
2101
2099
|
|
|
2102
2100
|
/**
|
|
@@ -1834,12 +1834,10 @@ function requireCrdtManager () {
|
|
|
1834
1834
|
|
|
1835
1835
|
/**
|
|
1836
1836
|
* Create a new instance
|
|
1837
|
-
* @param {string} replicaId - Choose a uuid (falls back to random uuid)
|
|
1838
1837
|
*/
|
|
1839
|
-
constructor(
|
|
1840
|
-
if (!replicaId) return console.error("No replicaId provided!");
|
|
1838
|
+
constructor(debug) {
|
|
1841
1839
|
if (debug) this.#debug = true;
|
|
1842
|
-
this.#replicaId =
|
|
1840
|
+
this.#replicaId = crypto.randomUUID();
|
|
1843
1841
|
this.#vectorClock.set(this.#replicaId, 0);
|
|
1844
1842
|
}
|
|
1845
1843
|
|
|
@@ -2360,7 +2358,7 @@ function requireServer () {
|
|
|
2360
2358
|
participants: [ws.clientId],
|
|
2361
2359
|
host: ws.clientId,
|
|
2362
2360
|
maxSize: data.size || null,
|
|
2363
|
-
crdtManager: new CRDTManager(
|
|
2361
|
+
crdtManager: new CRDTManager(this.#debug)
|
|
2364
2362
|
};
|
|
2365
2363
|
|
|
2366
2364
|
// Load state if provided
|
|
@@ -2508,7 +2506,7 @@ function requireServer () {
|
|
|
2508
2506
|
limit.lastReset = now;
|
|
2509
2507
|
}
|
|
2510
2508
|
|
|
2511
|
-
const pointCost =
|
|
2509
|
+
const pointCost = operationType == "create_room" ? 5 : 1;
|
|
2512
2510
|
if (limit.points < pointCost) return false;
|
|
2513
2511
|
|
|
2514
2512
|
limit.points -= pointCost;
|