Add account statuses

This commit is contained in:
2025-05-07 01:21:12 +08:00
parent fb07071603
commit ee7dc31b20
9 changed files with 2791 additions and 1 deletions

View File

@ -41,6 +41,11 @@ public class WebSocketService
ActiveConnections.TryRemove(key, out _);
}
public bool GetAccountIsConnected(long accountId)
{
return ActiveConnections.Any(c => c.Key.AccountId == accountId);
}
public void SendPacketToAccount(long userId, WebSocketPacket packet)
{
var connections = ActiveConnections.Where(c => c.Key.AccountId == userId);