Initial commit.
This commit is contained in:
20
Shared/SignalR/TunnelHub.cs
Normal file
20
Shared/SignalR/TunnelHub.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace ClientApiPoC.Shared.SignalR {
|
||||
public sealed class TunnelHub : Hub {
|
||||
private ClientTracker _clientTracker;
|
||||
|
||||
public TunnelHub(ClientTracker clientTracker) : base() {
|
||||
if (clientTracker == null) throw new ArgumentNullException(nameof(clientTracker));
|
||||
_clientTracker = clientTracker;
|
||||
}
|
||||
|
||||
public override sealed async Task OnConnectedAsync() {
|
||||
_ = _clientTracker.TryAddClientId(this.Context.ConnectionId);
|
||||
}
|
||||
|
||||
public override sealed async Task OnDisconnectedAsync(Exception exception) {
|
||||
_ = _clientTracker.TryRemoveClientId(this.Context.ConnectionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user