/// <summary> /// Removes a message handler for a specific channel /// </summary> /// <param name="channel">the channel to listen to</param> /// <param name="action">the message received action handler </param> public void RemoveListener(string channel, OnChannelMessageDelegate action) { if (!Listeners.ContainsKey(channel)) return; Listeners[channel].Remove(action); }
/// <summary> /// Adds a handler for a specific channel /// </summary> /// <param name="channel">the channel to listen to</param> /// <param name="action">the message received action handler </param> public void AddListener(string channel, OnChannelMessageDelegate action) { if (!Listeners.ContainsKey(channel)) Listeners.Add(channel, new List<OnChannelMessageDelegate>()); Listeners[channel].Add(action); }