I'm experiencing a weird issue, where a callback using SignalR sent to multiple clients gets delayed for some of the clients.
As you can see there's a full 7 second delay between client A receiving the callback and client B receiving the callback.
There is a "master" client does an invoke, at the end of a timer:
vm.bettingconnection
.invoke("MoveToNextRound", gameId)
.catch(function (err) {
return console.error(err.toString());
});
"vm" is a VueJS object
var vm = new Vue({
el: '#gamesquares',
data: function () {
return {
rawgamedata: [],
connection: "",
bettingconnection: "",
scorepredictShow: true,
boardShow: false,
timerShow: false,
expectationShow: false,
restseconds: 0,
roundseconds: 0,
restsecondsleft: 0,
roundsecondsleft: 0,
roundsleft: 0,
currentround: 0,
gamemode: 0,
estimatedpoints: 0,
scoreindex: 0,
currentscore: 0,
targetscore: 0
};
},
The invoked endpoint has very simple logic:
public async Task MoveToNextRound(Guid gameId)
{
int roundNumber = _gameAdministration.NextRound(gameId);
//need a try catch //game not found
await Clients.Groups(gameId.ToString()).MovedToNextRound(roundNumber);
}
Inside NextRound is this (also very simple)
public int NextRound(Guid gameId)
{
int roundNumber = _cache.Get<int>(gameId.ToString() + "-roundnumber");
roundNumber++;
_cache.Set(gameId.ToString() + "-roundnumber", roundNumber);
return roundNumber;
}
So this bit here is where I assume the problem lies:
await Clients.Groups(gameId.ToString()).MovedToNextRound(roundNumber);
Why is that callback is taking a while to get to some of the clients?