updated to shared lib
This commit is contained in:
@@ -20,7 +20,7 @@ public static class RtcEndpoints
|
||||
|
||||
RtcNotificationService.BroadcastToChannel(new RtcNotificationMessage
|
||||
{
|
||||
Type = "rtc_offer_updated",
|
||||
Type = SignalType.OfferUpdated,
|
||||
ChannelId = request.ChannelId,
|
||||
Username = request.Username
|
||||
});
|
||||
@@ -58,7 +58,7 @@ public static class RtcEndpoints
|
||||
|
||||
RtcNotificationService.BroadcastToChannel(new RtcNotificationMessage
|
||||
{
|
||||
Type = "rtc_answer_updated",
|
||||
Type = SignalType.AnswerUpdated,
|
||||
ChannelId = request.ChannelId
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ public static class RtcEndpoints
|
||||
|
||||
RtcNotificationService.BroadcastToChannel(new RtcNotificationMessage
|
||||
{
|
||||
Type = "rtc_candidate_added",
|
||||
Type = SignalType.CandidateAdded,
|
||||
ChannelId = request.ChannelId,
|
||||
Username = request.Username,
|
||||
Direction = JsonSerializer.Serialize(request.Candidate)
|
||||
@@ -124,7 +124,7 @@ public static class RtcEndpoints
|
||||
|
||||
RtcNotificationService.BroadcastToChannel(new RtcNotificationMessage
|
||||
{
|
||||
Type = "rtc_call_left",
|
||||
Type = SignalType.CallLeft,
|
||||
ChannelId = request.ChannelId,
|
||||
Username = request.Username
|
||||
});
|
||||
|
||||
@@ -156,7 +156,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
|
||||
var payload = new SocketChannelList
|
||||
{
|
||||
Type = "channel_list",
|
||||
Type = SignalType.ChannelList,
|
||||
Channels = channels
|
||||
};
|
||||
|
||||
@@ -176,7 +176,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
|
||||
var payload = new ServerPublicKeyMessage
|
||||
{
|
||||
Type = "server_public_key",
|
||||
Type = SignalType.ServerPublicKey,
|
||||
PublicKey = ServerPublicKey
|
||||
};
|
||||
|
||||
@@ -202,7 +202,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
return;
|
||||
}
|
||||
|
||||
if (clientPayload is null || clientPayload.Type != "client_encrypted_chat")
|
||||
if (clientPayload is null || clientPayload.Type != SignalType.ClientEncryptedChat)
|
||||
return;
|
||||
|
||||
if (!EnsureCoreReady() || !EnsureCryptoReady())
|
||||
@@ -262,7 +262,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
|
||||
var outbound = new SocketEncryptedMessage
|
||||
{
|
||||
Type = "encrypted_chat",
|
||||
Type = SignalType.EncryptedChat,
|
||||
SenderUsername = clientPayload.SenderUsername,
|
||||
RecipientUsername = client.Username,
|
||||
ChannelId = clientPayload.ChannelId,
|
||||
@@ -340,7 +340,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
|
||||
var outbound = new SocketEncryptedMessage
|
||||
{
|
||||
Type = "encrypted_chat",
|
||||
Type = SignalType.EncryptedChat,
|
||||
SenderUsername = ExtractUsernameFromUserId(dbMessage.SenderUserId),
|
||||
RecipientUsername = username,
|
||||
ChannelId = channelId,
|
||||
|
||||
@@ -25,22 +25,4 @@ public static class RtcNotificationService
|
||||
host.Sessions.SendTo(json, sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void BroadcastToChannel(RtcIceNotificationMessage message)
|
||||
{
|
||||
if (Server is null)
|
||||
return;
|
||||
|
||||
var host = Server.WebSocketServices["/"];
|
||||
if (host is null)
|
||||
return;
|
||||
|
||||
var json = JsonSerializer.Serialize(message);
|
||||
var sessionIds = RtcChannelPresenceService.GetSessionsInChannel(message.ChannelId);
|
||||
|
||||
foreach (var sessionId in sessionIds)
|
||||
{
|
||||
host.Sessions.SendTo(json, sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user