1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-21 21:09:22 +00:00

Can close all active websockets of a user

This commit is contained in:
Pierre HUBERT 2020-04-18 12:27:39 +02:00
parent 59825401b5
commit f8cf4c5c9c

View File

@ -220,6 +220,16 @@ export class UserWebSocketController {
entry.ws.close();
}
/**
* Close all user websockets
*
* @param userID Target user ID
*/
public static async CloseAllUserSockets(userID: number) {
for(const entry of this.active_clients.filter((f) => f.userID == userID))
entry.ws.close();
}
/**
* Send a message to a socket
*