refactor SDK to stateful architecture and implement reactive websocket handling
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Chtn.CSharp.SDK.Core;
|
||||
using Chtn.CSharp.SDK.Models.Call;
|
||||
using Chtn.CSharpSDK.Core;
|
||||
|
||||
namespace Chtn.CSharp.SDK.Services
|
||||
{
|
||||
@@ -15,10 +16,28 @@ namespace Chtn.CSharp.SDK.Services
|
||||
public class BroadcastServiceProvider : IBroadcastService
|
||||
{
|
||||
private readonly ApiClient _apiClient;
|
||||
private readonly string _channelId;
|
||||
private readonly string _categoryId;
|
||||
private readonly string _networkId;
|
||||
private readonly string _userId;
|
||||
private string _connId;
|
||||
|
||||
public BroadcastServiceProvider(ApiClient apiClient)
|
||||
public BroadcastServiceProvider(
|
||||
ApiClient apiClient,
|
||||
string channelId,
|
||||
string categoryId,
|
||||
string networkId,
|
||||
string userId)
|
||||
{
|
||||
_apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
|
||||
_channelId = channelId;
|
||||
_categoryId = categoryId;
|
||||
_networkId = networkId;
|
||||
_userId = userId;
|
||||
|
||||
var ws = WebSocketHandler.GetInstance();
|
||||
this._connId = ws.ConnId;
|
||||
ws.OnNewConnectionId += (newConnId) => this._connId = newConnId;
|
||||
}
|
||||
|
||||
public async Task<StreamRegistry> GetData(GetRtmpDataReq req) =>
|
||||
Reference in New Issue
Block a user