using System.Threading.Tasks; using Microsoft.Extensions.Logging; using xPushService.Interfaces; using Microsoft.AspNetCore.SignalR; using xPushService.Constants; using xCommons.Extensions; using System.Threading; namespace xPushService.Base { public abstract class XBaseWebRTCHub : XBaseHub, IXBaseWebRTCHub { // #region Props ... #endregion // #region Constructor ... protected XBaseWebRTCHub( ILogger logger ) : base(logger) { } #endregion // #region WebRTCActions ... /// /// Sending WebRTC Offer To Specified Connection ... /// /// /// /// /// public async Task Offer( string offer, string to, CancellationToken cancellationToken = default ) { // await Clients.Client(to).SendAsync( XWebRTCAction.Offer.GetStringValue(), offer, cancellationToken ); } /// /// Sending WebRTC Answer to Specified Connection ... /// /// /// /// public async Task Answer( string answer, CancellationToken cancellationToken = default ) { // await Clients.All.SendAsync( XWebRTCAction.Answer.GetStringValue(), answer, Context.ConnectionId, cancellationToken ); } /// /// Sending WebRTC Candidate to Specified Connecton ... /// /// /// /// /// 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, cancellationToken ); } else { // await Clients.All.SendAsync( actionName, candidate, Context.ConnectionId, cancellationToken ); } } #endregion } }