Пример #1
0
 public HubEventEmitter(IPbxConnection connection, IHubContext <PresenceHub> hubContext)
 {
     _hubContext = hubContext;
     _connection.OnUserUpdated((e) =>
     {
         _hubContext.Clients.All.SendAsync("UpdateUser", "updateuserobject");
     });
 }
 /// <summary>
 /// Constructor, pbx connection must be provided by dependency injection
 /// </summary>        
 public PresenceHub(IPbxConnection connection)
 {
     _connection = connection;
     _connection.OnUserUpdated((e) =>
     {                
         Clients.All.SendAsync("UpdateUser", "updateuserobject");
     });
     _connection.Connect();
 }
Пример #3
0
    public PresenceHub(IPbxConnection connection)
    {
        hubConnection = new HubConnectionBuilder().WithUrl("localhost\mysignalrhub").Build();
        hubConnection.StartAsync().Wait();

        _connection = connection;
        _connection.OnUserUpdated((e) =>
        {
            hubConnection.InvokeAsync("Send", e).Wait();
        });
        _connection.Connect();
    }