Skip to content

Commit

Permalink
Add StreamerState and ability to reconnect after reboots.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Sep 7, 2023
1 parent 9128a24 commit 1baa967
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Server/Services/RcImplementations/HubEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Immense.RemoteControl.Server.Abstractions;
using Immense.RemoteControl.Server.Hubs;
using Immense.RemoteControl.Server.Models;
using Immense.RemoteControl.Shared.Enums;
using Immense.RemoteControl.Shared.Interfaces;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Remotely.Server.Hubs;
Expand All @@ -15,15 +17,18 @@ public class HubEventHandler : IHubEventHandler
{
private readonly IHubContext<AgentHub, IAgentHubClient> _serviceHub;
private readonly IAgentHubSessionCache _agentCache;
private readonly IHubContext<ViewerHub, IViewerHubClient> _viewerHub;
private readonly ILogger<HubEventHandler> _logger;

public HubEventHandler(
IHubContext<AgentHub, IAgentHubClient> serviceHub,
IHubContext<AgentHub, IAgentHubClient> agentHub,
IHubContext<ViewerHub, IViewerHubClient> viewerHub,
IAgentHubSessionCache agentHubSessionCache,
ILogger<HubEventHandler> logger)
{
_serviceHub = serviceHub;
_serviceHub = agentHub;
_agentCache = agentHubSessionCache;
_viewerHub = viewerHub;
_logger = logger;
}

Expand Down Expand Up @@ -135,6 +140,9 @@ public async Task RestartScreenCaster(RemoteControlSession session)

if (!_agentCache.TryGetConnectionId(sessionEx.DeviceId, out var agentConnectionId))
{
await _viewerHub.Clients
.Clients(sessionEx.ViewerList)
.ShowMessage("Waiting for agent to come online");

return;
}
Expand Down

0 comments on commit 1baa967

Please sign in to comment.