playsocketjs 2.6.0 → 2.6.1
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.
|
@@ -2083,6 +2083,8 @@ class CRDTManager {
|
|
|
2083
2083
|
|
|
2084
2084
|
/* eslint-disable jsdoc/require-returns */
|
|
2085
2085
|
|
|
2086
|
+
const MAX_ROOM_SIZE = 500;
|
|
2087
|
+
|
|
2086
2088
|
/**
|
|
2087
2089
|
* @typedef {import('node:http').Server} HttpServer
|
|
2088
2090
|
* @typedef {import('ws').WebSocket} WebSocket
|
|
@@ -2639,9 +2641,9 @@ class PlaySocketServer {
|
|
|
2639
2641
|
/**
|
|
2640
2642
|
* Create a room from the server
|
|
2641
2643
|
* @param {object} [initialStorage] - Optional initial storage object
|
|
2642
|
-
* @param {number} [size] - Max. room size, up to
|
|
2644
|
+
* @param {number} [size] - Max. room size, up to 500
|
|
2643
2645
|
* @param {string} [host] - Host ID, defaults to "server" (when set to "server", room will not be deleted if all clients leave)
|
|
2644
|
-
* @returns {object}
|
|
2646
|
+
* @returns {object} Object containing room state and room ID
|
|
2645
2647
|
*/
|
|
2646
2648
|
createRoom(initialStorage, size, host = "server") {
|
|
2647
2649
|
let newRoomId;
|
|
@@ -2665,7 +2667,7 @@ class PlaySocketServer {
|
|
|
2665
2667
|
this.#rooms[newRoomId] = {
|
|
2666
2668
|
participants: [],
|
|
2667
2669
|
host,
|
|
2668
|
-
size: Math.min(Number(size),
|
|
2670
|
+
size: Math.min(Number(size), MAX_ROOM_SIZE) || MAX_ROOM_SIZE,
|
|
2669
2671
|
crdtManager: roomCrdtManager
|
|
2670
2672
|
};
|
|
2671
2673
|
|