Updatedededed...? Still needs testing.
This commit is contained in:
@@ -8,12 +8,21 @@ public static class RtcNotificationService
|
||||
{
|
||||
public static WebSocketServer? Server { get; set; }
|
||||
|
||||
public static void Broadcast(RtcNotificationMessage message)
|
||||
public static void BroadcastToChannel(RtcNotificationMessage message)
|
||||
{
|
||||
if (Server is null)
|
||||
return;
|
||||
|
||||
var host = Server.WebSocketServices["/"];
|
||||
if (host is null)
|
||||
return;
|
||||
|
||||
var json = JsonSerializer.Serialize(message);
|
||||
Server.WebSocketServices["/"]?.Sessions.Broadcast(json);
|
||||
var sessionIds = RtcChannelPresenceService.GetSessionsInChannel(message.ChannelId);
|
||||
|
||||
foreach (var sessionId in sessionIds)
|
||||
{
|
||||
host.Sessions.SendTo(json, sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user