Skip to content

Commit 94ff492

Browse files
committed
fix: Resolved #12
1 parent 3d68875 commit 94ff492

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib/Structures/NodeServerClient.ts

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ export class NodeServerClient extends SocketHandler {
2424
const sName = await this.send(kIdentify);
2525
this.status = STATUS.READY;
2626
this.name = sName;
27+
28+
// Disconnect if a previous socket existed.
29+
const existing = this.server.clients.get(sName);
30+
if (existing) {
31+
existing.disconnect();
32+
}
33+
34+
// Add this socket to the clients.
2735
this.server.clients.set(sName, this);
2836
this.node.emit('client.identify', this);
2937
} catch {

0 commit comments

Comments
 (0)