public void StartYakkrTicker(YakkrTickerModel model) { _yakkrDictionary.TryAdd(model.AppUserState.ConnectionId, model); BroadcastYakkrTicker(); }
public IEnumerable <YakkrTickerModel> GetYakkrTickerData(YakkrTickerModel model) { model.YakkrCount = Convert.ToString(Utilities.Helper.GetYakkrCountByUserId(model.AppUserState.UserId, model.AppUserState.AgencyId)); return(new List <YakkrTickerModel> { model }); }
public override Task OnReconnected() { string name = Context.User.Identity.Name; var connections = _connections.GetConnections(name); if (connections.Where(x => x.ConnectionId == Context.ConnectionId).Any()) { _connections.Add(name, connections.Where(x => x.ConnectionId == Context.ConnectionId).FirstOrDefault()); YakkrTickerModel model = new YakkrTickerModel(); model.AppUserState = connections.Where(x => x.ConnectionId == Context.ConnectionId).FirstOrDefault(); _yakkrTicker.AddYakkrTickerClient(Context.ConnectionId, model); } return(base.OnConnected()); }
public void Initialize(AppUserState appUserState) { var contexts = _connections.GetConnections(Context.User.Identity.Name).Where(x => x.ConnectionId == Context.ConnectionId && x.UserRoleType == "YakkrHub").ToList(); contexts.ForEach(x => { x.AgencyId = appUserState.AgencyId; x.UserId = appUserState.UserId; x.RoleId = appUserState.RoleId; }); Parallel.ForEach(contexts, (current) => { _connections.Add(Context.User.Identity.Name, current); }); SetNotificationEntry(); YakkrTickerModel model = new YakkrTickerModel(); model.AppUserState = appUserState; _yakkrTicker.StartYakkrTicker(model); }
public void RemoveYakkrTickerClient(string key) { YakkrTickerModel model = new YakkrTickerModel(); _yakkrDictionary.TryRemove(key, out model); }
public void AddYakkrTickerClient(string key, YakkrTickerModel model) { _yakkrDictionary.TryAdd(key, model); }