Add SendMessageToAll method (#484)

* Fix typo

* Add SendMessageToAll method
This commit is contained in:
Lacyway
2025-07-16 12:34:05 +02:00
committed by GitHub
parent e27b2b91e3
commit 32510bd67f
2 changed files with 12 additions and 1 deletions
@@ -50,7 +50,7 @@ public class NotificationSendHelper(
if (logger.IsLogEnabled(LogLevel.Debug))
{
logger.Debug(
$"Send message for {sessionID} websocket not available, queuing into profile"
$"Send message for {sessionID} websocket not available, queueing into profile"
);
}
notificationService.Add(sessionID, notificationMessage);
@@ -163,6 +163,17 @@ public class SptWebSocketConnectionHandler(
}
}
public void SendMessageToAll(WsNotificationEvent output)
{
lock (_socketsLock)
{
foreach (var sessionID in _sockets.Keys)
{
SendMessage(sessionID, output); // this currently serializes for every socket, might want to separate into sending already serialized data
}
}
}
public void SendMessage(string sessionID, WsNotificationEvent output)
{
try