add some new features in data service ...

This commit is contained in:
2026-05-15 19:41:43 +03:30
parent 35e1e08d50
commit f929414b9f
15 changed files with 1826 additions and 34 deletions
+45 -7
View File
@@ -4,6 +4,7 @@ using xPushService.Interfaces;
using Microsoft.AspNetCore.SignalR;
using xPushService.Constants;
using xCommons.Extensions;
using System.Threading;
namespace xPushService.Base
{
@@ -28,20 +29,40 @@ namespace xPushService.Base
/// </summary>
/// <param name="offer"></param>
/// <param name="to"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task Offer(string offer, string to)
public async Task Offer(
string offer,
string to,
CancellationToken cancellationToken = default
)
{
await Clients.Client(to).SendAsync(XWebRTCAction.Offer.GetStringValue(), offer);
//
await Clients.Client(to).SendAsync(
XWebRTCAction.Offer.GetStringValue(),
offer,
cancellationToken
);
}
/// <summary>
/// Sending WebRTC Answer to Specified Connection ...
/// </summary>
/// <param name="answer"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task Answer(string answer)
public async Task Answer(
string answer,
CancellationToken cancellationToken = default
)
{
await Clients.All.SendAsync(XWebRTCAction.Answer.GetStringValue(), answer, Context.ConnectionId);
//
await Clients.All.SendAsync(
XWebRTCAction.Answer.GetStringValue(),
answer,
Context.ConnectionId,
cancellationToken
);
}
/// <summary>
@@ -49,18 +70,35 @@ namespace xPushService.Base
/// </summary>
/// <param name="candidate"></param>
/// <param name="to"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task Candidate(string candidate, string to)
public async Task Candidate(
string candidate,
string to,
CancellationToken cancellationToken = default
)
{
//
string actionName = XWebRTCAction.Candidate.GetStringValue();
if (!string.IsNullOrEmpty(to))
{
await Clients.Client(to).SendAsync(actionName, candidate, Context.ConnectionId);
//
await Clients.Client(to).SendAsync(
actionName,
candidate,
Context.ConnectionId,
cancellationToken
);
}
else
{
await Clients.All.SendAsync(actionName, candidate, Context.ConnectionId);
//
await Clients.All.SendAsync(
actionName,
candidate,
Context.ConnectionId,
cancellationToken
);
}
}
#endregion