I use SignalR and .NET6. I have a three-way setup where I have a Server (C#), a Host (C#) and many Clients (JS).
My Server receives a Client Declaration from any client which connects it with a Host. The Client and Host don't actually know each other and only get to hear about each other through the server.
When my Client declares itself and gives an access token to be tied to a Host, I trigger the following two lines:
await Clients.Caller.SendAsync(ClientListenEvent.DeclareClientAck, (int)response, clientId);
await Clients.User(host.HostId).SendAsync(HostListenEvent.ClientJoin, clientId);
The first line lets the Client know that it is declared on the server successfully. However the second line never triggers anything on the associated Host. It simply gets emitted by the Server and then the Host never picks it up.
On the Host it's supposed to trigger this SignalR event:
connector.On<string>("clientJoin", (clientId) =>
{
OnClientJoin?.Invoke(this, clientId);
Debug.Log($"Adding Client: [{_indexToClientMap.Count};{clientId}]");
_indexToClientMap.Add(_indexToClientMap.Count, clientId);
});
But it never does. I'm not quite sure why that is and I've been trying to debug this for a couple of hours today. Any help?