- Implement unread state sync for SSE
This commit is contained in:
@@ -7,10 +7,11 @@ namespace ChatTwo.Http.MessageProtocol;
|
||||
/// <summary>
|
||||
/// Contains a valid tab with its assigned index
|
||||
/// </summary>
|
||||
public struct ChatTab(string name, int index)
|
||||
public struct ChatTab(string name, int index, uint unreadCount)
|
||||
{
|
||||
[JsonProperty("name")] public string Name = name;
|
||||
[JsonProperty("index")] public int Index = index;
|
||||
[JsonProperty("unreadCount")] public uint UnreadCount = unreadCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -21,6 +22,15 @@ public struct ChatTabList(ChatTab[] tabs)
|
||||
[JsonProperty("tabs")] public ChatTab[] Tabs = tabs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains a valid tab index and the current unread state as a number unread of messages
|
||||
/// </summary>
|
||||
public struct ChatTabUnreadState(int index, uint unreadCount)
|
||||
{
|
||||
[JsonProperty("index")] public int Index = index;
|
||||
[JsonProperty("unreadCount")] public uint UnreadCount = unreadCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains the current channel name
|
||||
/// </summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ public class CloseEvent() : BaseEvent("close");
|
||||
// Tab related
|
||||
public class ChatTabListEvent(ChatTabList list) : BaseEvent("tab-list", JsonConvert.SerializeObject(list));
|
||||
public class ChatTabSwitchedEvent(ChatTab chatTab) : BaseEvent("tab-switched", JsonConvert.SerializeObject(chatTab));
|
||||
public class ChatTabUnreadStateEvent(ChatTabUnreadState unreadState) : BaseEvent("tab-unread-state", JsonConvert.SerializeObject(unreadState));
|
||||
|
||||
// Input channel related
|
||||
public class ChannelListEvent(ChannelList channelList) : BaseEvent("channel-list", JsonConvert.SerializeObject(channelList));
|
||||
|
||||
Reference in New Issue
Block a user