/// <summary> /// Creates a connection for this connection context /// </summary> /// <param name="connectionId"></param> /// <param name="hubChannelManager"></param> private void AddConnection(string connectionId, HubChannelManager hubChannelManager = null) { if (this.Connections.ContainsKey(connectionId) == false) { var channelManager = hubChannelManager ?? new HubChannelManager(); this.Connections.Add(connectionId, channelManager); } }
/// <summary> /// Saves the channel registered for this connection context /// </summary> /// <param name="connectionId"></param> /// <param name="channel"></param> private void SaveChannel(string connectionId, string channel) { if (this.Connections.ContainsKey(connectionId)) { var hubChannelManager = this.Connections[connectionId]; hubChannelManager.AddChannel(channel, this.Context.User.Identity); } else { var hubChannelManager = new HubChannelManager(); hubChannelManager.AddChannel(channel, this.Context.User.Identity); this.AddConnection(connectionId, hubChannelManager); } }