/// <summary> /// Processes the received text packet. /// </summary> /// <param name="packetMessage">The receive text packet</param> /// <returns>An awaitable task</returns> protected override Task ProcessReceivedPacket(string packetMessage) { if (!string.IsNullOrEmpty(packetMessage)) { ClientResponsePacketModel packet = new ClientResponsePacketModel(packetMessage); if (packet.IsReplyEvent) { if (this.replyIDListeners.ContainsKey(packet.NormalRef)) { this.replyIDListeners[packet.NormalRef] = packet; } } if (this.chatSubscriptions.Contains(packet.Topic)) { ChatMessagePacketModel message = new ChatMessagePacketModel(packetMessage); this.OnChatMessageReceived?.Invoke(this, message); } else if (this.channelSubscriptions.Contains(packet.Topic)) { ChannelUpdatePacketModel channelUpdate = new ChannelUpdatePacketModel(packetMessage); this.OnChannelUpdated?.Invoke(this, channelUpdate); } else if (this.followSubscriptions.Contains(packet.Topic)) { FollowPacketModel follow = new FollowPacketModel(packetMessage); this.OnFollowOccurred?.Invoke(this, follow); } } return(Task.FromResult(0)); }
private static void Client_OnFollowOccurred(object sender, FollowPacketModel follow) { System.Console.WriteLine(string.Format("User Followed: {0}", follow.Follow.user?.username)); }