clean disconnected sockets
This commit is contained in:
+12
-2
@@ -34,7 +34,17 @@ export class SubscriptionMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete(ws: WS, channel: string) {
|
delete(ws: WS, channel: string) {
|
||||||
this.getChannelList(ws)?.delete(channel);
|
const channelList = this.getChannelList(ws);
|
||||||
this.getClientList(channel)?.delete(ws);
|
const clientList = this.getClientList(channel);
|
||||||
|
|
||||||
|
channelList?.delete(channel);
|
||||||
|
if (channelList?.size == 0) {
|
||||||
|
this.channelsPerClient.delete(ws);
|
||||||
|
}
|
||||||
|
|
||||||
|
clientList?.delete(ws);
|
||||||
|
if (clientList?.size == 0) {
|
||||||
|
this.clientsPerChannel.delete(channel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user