playsocketjs 4.3.1 → 4.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playsocketjs",
3
- "version": "4.3.1",
3
+ "version": "4.3.2",
4
4
  "description": "WebSocket wrapper for creating simple multiplayer systems with ease.",
5
5
  "type": "module",
6
6
  "module": "./src/client/client.js",
@@ -152,7 +152,7 @@ export default class PlaySocketServer {
152
152
  }
153
153
 
154
154
  // Register client ID if provided & check for a duplicate
155
- if (data.id && (this.#clients.get(data.id) || data.id === "server")) {
155
+ if (data.id && (this.#clients.get(data.id) || this.#pendingDisconnects.has(data.id) || data.id === "server")) {
156
156
  ws.send(encode({ type: "registration_failed", reason: "ID is taken" }), { binary: true });
157
157
  return;
158
158
  }
@@ -161,7 +161,7 @@ export default class PlaySocketServer {
161
161
  if (!data.id) {
162
162
  for (let i = 0; i < 50; i++) {
163
163
  const id = this.#generateId();
164
- if (!this.#clients.get(id)) {
164
+ if (!this.#clients.get(id) && !this.#pendingDisconnects.has(id)) {
165
165
  data.id = id;
166
166
  break;
167
167
  }
@@ -9,7 +9,7 @@ export const HEARTBEAT_INTERVAL = 5000;
9
9
  /**
10
10
  * Library version, must match package.json
11
11
  */
12
- export const VERSION = "4.3.0";
12
+ export const VERSION = "4.3.2";
13
13
 
14
14
  /**
15
15
  * Logging prefixes
@@ -8,7 +8,7 @@ export declare const HEARTBEAT_INTERVAL = 5000;
8
8
  /**
9
9
  * Library version, must match package.json
10
10
  */
11
- export declare const VERSION = "4.3.0";
11
+ export declare const VERSION = "4.3.2";
12
12
  /**
13
13
  * Logging prefixes
14
14
  */