Пример #1
0
        private async Task ConnectToWorkerSignalrHub()
        {
            try
            {
                _hubConnection = HubProxy.BuildConnection("systemHub");

                _hubConnection.On <SystemOverview>("ReceiveSystemOverview", (so) =>
                {
                    SystemOverview = so;
                    StateHasChanged();
                });

                _hubConnection.On <LogMessage>("ReceiveLog", (log) =>
                {
                    LogItems.AddFirst(log);
                    StateHasChanged();
                });

                await _hubConnection.StartAsync();
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to connect to Signalr hub of Worker");
            }
        }