From 58594836548ff48e91eb4bbf929577f923e91c09 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 8 Aug 2025 03:06:20 +0800 Subject: [PATCH] :recycle: Update the websocket dupe conn handle --- DysonNetwork.Pusher/Connection/WebSocketController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DysonNetwork.Pusher/Connection/WebSocketController.cs b/DysonNetwork.Pusher/Connection/WebSocketController.cs index dd6992a..6d0245a 100644 --- a/DysonNetwork.Pusher/Connection/WebSocketController.cs +++ b/DysonNetwork.Pusher/Connection/WebSocketController.cs @@ -39,6 +39,16 @@ public class WebSocketController(WebSocketService ws, ILogger if (!ws.TryAdd(connectionKey, webSocket, cts)) { + await webSocket.SendAsync( + new ArraySegment(new WebSocketPacket + { + Type = "error.dupe", + ErrorMessage = "Too many connections from the same device and account." + }.ToBytes()), + WebSocketMessageType.Close, + true, + CancellationToken.None + ); await webSocket.CloseAsync( WebSocketCloseStatus.PolicyViolation, "Too many connections from the same device and account.",