Fixed session if changing in the Web Socket Chat bot.

This commit is contained in:
Anon 2026-03-25 21:59:01 +01:00
parent bd55fc3ed3
commit 05afeaf5bc

View file

@ -99,15 +99,15 @@ public class WebSocketServer
{ {
var message = Encoding.UTF8.GetString(messageBuffer.ToArray()); var message = Encoding.UTF8.GetString(messageBuffer.ToArray());
messageBuffer.Clear(); messageBuffer.Clear();
MessageReceived?.Invoke(sessionId, message); MessageReceived?.Invoke(session.SessionId, message);
} }
} }
} }
catch { /* connection dropped */ } catch { /* connection dropped */ }
finally finally
{ {
_sessions.TryRemove(sessionId, out _); _sessions.TryRemove(session.SessionId, out _);
SessionDropped?.Invoke(sessionId); SessionDropped?.Invoke(session.SessionId);
if (ws.State == WebSocketState.Open || ws.State == WebSocketState.CloseReceived) if (ws.State == WebSocketState.Open || ws.State == WebSocketState.CloseReceived)
{ {