public static async Task UpdateAllClientsTeamChanged(IHubContext <LevelScoreHub> instance, Team team) { using (new RWLockHelper(Program.RWLockTeams, RWLockHelper.LockMode.Read)) { await instance.Clients.All.SendAsync("update_one", ViewUpdate.Create(team)); } }
public async Task RequestAllData() { using (new RWLockHelper(Program.RWLockTeams, RWLockHelper.LockMode.Read)) { var allVU = Program.Teams.Select(t => ViewUpdate.Create(t)).ToList(); await Clients.Caller.SendAsync("update_all", allVU); } }
public static async Task UpdateAllClientsFull(IHubContext <LevelScoreHub> instance) { using (new RWLockHelper(Program.RWLockTeams, RWLockHelper.LockMode.Read)) { var allVU = Program.Teams.Select(t => ViewUpdate.Create(t)).ToList(); await instance.Clients.All.SendAsync("update_all", allVU); } }
public override async Task OnConnectedAsync() { Console.WriteLine($"Client {Clients.Caller} connected"); var t1 = Clients.Caller.SendAsync("update_title", Program.GameTitle); using (new RWLockHelper(Program.RWLockTeams, RWLockHelper.LockMode.Read)) { var allList = Program.Teams.Select(t => ViewUpdate.Create(t)).ToList(); var t2 = Clients.Caller.SendAsync("update_all", allList); await t2; } await t1; }