Use SptWebSocketConnectionHandler directly

This commit is contained in:
Archangel
2025-05-06 14:50:22 +02:00
parent a190198582
commit 19c8c5e401
@@ -11,7 +11,7 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class NotificationSendHelper(
IEnumerable<IWebSocketConnectionHandler> _sptWebSocketConnectionHandler,
SptWebSocketConnectionHandler _sptWebSocketConnectionHandler,
HashUtil _hashUtil,
SaveServer _saveServer,
NotificationService _notificationService,
@@ -25,13 +25,9 @@ public class NotificationSendHelper(
/// <param name="notificationMessage"></param>
public void SendMessage(string sessionID, WsNotificationEvent notificationMessage)
{
var sptWebSocketConnectionHandler = _sptWebSocketConnectionHandler
.OfType<SptWebSocketConnectionHandler>()
.FirstOrDefault(wsh => wsh.GetHookUrl() == "/notifierServer/getwebsocket/");
if (sptWebSocketConnectionHandler.IsWebSocketConnected(sessionID))
if (_sptWebSocketConnectionHandler.IsWebSocketConnected(sessionID))
{
sptWebSocketConnectionHandler.SendMessage(sessionID, notificationMessage);
_sptWebSocketConnectionHandler.SendMessage(sessionID, notificationMessage);
}
else
{