Beispiel #1
0
        private void InitHubEvents()
        {
            _hubConnection.On <string>("UpdateOnlineUsers", (message) =>
            {
                OnOnlineUsersUpdated?.Invoke(message.FromJson <List <User> >());
            });

            _hubConnection.On <int>("UpdateBalance", (balance) =>
            {
                OnBalanceUpdated?.Invoke(balance);
            });

            _hubConnection.On <string>("IncomingCall", (connectionId) =>
            {
                OnIncomingCall?.Invoke(connectionId);
            });

            _hubConnection.On <string>("CallAccepted", (connectionId) =>
            {
                OnCallAccepted?.Invoke(connectionId);
            });

            _hubConnection.On <string>("CallDeclined", (message) =>
            {
                OnCallDeclined?.Invoke(message.FromJson <UserActionMessage>());
            });

            _hubConnection.On <string>("CallEnded", (message) =>
            {
                OnCallEnded?.Invoke(message.FromJson <UserActionMessage>());
            });

            _hubConnection.On <string>("CallDenied", (message) =>
            {
                OnCallDenied?.Invoke(message.FromJson <ServerActionMessage>());
            });

            _hubConnection.On <string>("Poll", (message) =>
            {
                OnPoll?.Invoke(message.FromJson <PollMessage>());
            });

            _hubConnection.On <string, string>("ReceiveSignal", (connectionId, data) =>
            {
                OnSignalReceived?.Invoke(connectionId, data);
            });


            _hubConnection.On <string>("UpdateUsers", (message) =>
            {
                OnUsersUpdated?.Invoke(message.FromJson <List <User> >());
            });

            _hubConnection.On <string>("UpdateCalls", (message) =>
            {
                OnCallsUpdated?.Invoke(message.FromJson <List <UserCall> >());
            });

            _hubConnection.On <string>("CallAborted", (message) =>
            {
                OnCallAborted?.Invoke(message.FromJson <ServerActionMessage>());
            });
        }
 protected override Task Poll()
 {
     Schedule(() => OnPoll?.Invoke());
     return(base.Poll());
 }