Core 3.1 application
Totally at loss here.
I have 2 clients (phone and tablet) which connect to a signalR hub where I register them each as a group:
public class OrderHub : Hub
{
public string GetConnectionId()
{
return Context.ConnectionId;
}
public async void RegisterDeviceOnGroup() { //for example purposes just using tablet
await Groups.AddToGroupAsync(Context.ConnectionId, 'tablet');
}
}
Then when I communicate between the 2, I call a method on a controller where the hub as been injected:
private readonly IHubContext<OrderHub> _hubContext;
public CustomerRepository(IHubContext<OrderHub> hubContext)
{
_hubContext = hubContext;
}
private async Task<bool> BroadcastOrder() { //Broadcast to tablet
await _hubContext.Clients.Group('tablet).SendAsync("Message");
}
This works fine for a few minutes and then stops. I can 't see anything in logs or any reason why it would.
Can the injected hub context lose groups?