using System.Threading.Tasks; using Microsoft.Extensions.Logging; using xPushService.Interfaces; using Microsoft.AspNetCore.SignalR; using xPushService.Constants; using xCommons.Extensions; 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) { await Clients.Client(to).SendAsync(XWebRTCAction.Offer.GetStringValue(), offer); } /// /// Sending WebRTC Answer to Specified Connection ... /// /// /// public async Task Answer(string answer) { await Clients.All.SendAsync(XWebRTCAction.Answer.GetStringValue(), answer, Context.ConnectionId); } /// /// Sending WebRTC Candidate to Specified Connecton ... /// /// /// /// public async Task Candidate(string candidate, string to) { // string actionName = XWebRTCAction.Candidate.GetStringValue(); if (!string.IsNullOrEmpty(to)) { await Clients.Client(to).SendAsync(actionName, candidate, Context.ConnectionId); } else { await Clients.All.SendAsync(actionName, candidate, Context.ConnectionId); } } #endregion } }