private async Task <HubOnConnectionState> TryRequestCharacterGuildStatus(NetworkEntityGuid guid, string userIdentifier) { ResponseModel <CharacterGuildMembershipStatusResponse, CharacterGuildMembershipStatusResponseCode> response = null; try { response = await SocialService.GetCharacterMembershipGuildStatus(int.Parse(userIdentifier)) .ConfigureAwaitFalse(); } catch (Exception e) { if (Logger.IsEnabled(LogLevel.Error)) { Logger.LogError($"Failed to get guild status of Connection: {userIdentifier}. Exception: {e.Message}\n\nStack:{e.StackTrace}"); } return(HubOnConnectionState.Abort); } //Don't ADD, we have to assume that we might have an entity, maybe web or mobile, already connected //and merely just update the guild status if (response.isSuccessful) { GuildStatusMappable.Add(guid, response.Result); } return(HubOnConnectionState.Success); }
private async Task RegisterGuildOnExistingResponse(NetworkEntityGuid guid, IGroupManager groupManager, string connectionId) { //If no guild status exists we cannot register a guild channel. if (!GuildStatusMappable.ContainsKey(guid)) { return; } //TODO: don't hardcode await groupManager.AddToGroupAsync(connectionId, $"guild:{GuildStatusMappable.RetrieveEntity(guid).GuildId}") .ConfigureAwaitFalseVoid(); }