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
package/src/server/server.js
CHANGED
|
@@ -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
|
}
|