public async Task LoginUserToken(StandardCommand c) { if (c.SessionToken != null) { (ListOf_DBResult flag, string userName) = await HoloData.LoginUserToken(c.SessionToken); if (flag == ListOf_DBResult.Success) { if (connectedUsers.ContainsKey(Context.ConnectionId)) { connectedUsers[Context.ConnectionId].SessionToken = c.SessionToken; await Clients.Caller.SendAsync("ServerLogin", flag, c.SessionToken, userName); System.Console.WriteLine($"Token User: {Context.ConnectionId}"); System.Console.WriteLine($"Session Token: {c.SessionToken}"); } else { System.Console.WriteLine("Bad Client Token"); } } else { System.Console.WriteLine("Login Rejected"); await Clients.Caller.SendAsync("ServerLogin", flag); } } }
public async Task FetchAdventure(StandardCommand c) { if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken) { (ListOf_DBResult flag, Group group) = await HoloData.FetchAdventure(c.SessionToken); UpdateModel updateModel = new UpdateModel(); updateModel.AddAdventure(group); ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel); } }
public async Task FetchRoster(StandardCommand c) { if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken) { (ListOf_DBResult flag, List <Character> characters) = await HoloData.FetchCharacters(c.SessionToken); UpdateModel updateModel = new UpdateModel(); updateModel.AddCharacters(characters); ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel); } }