聊天历史记录
Retrieve and manage chat message history.
阅读时间1 分钟最后更新于 13 天前
频道文本消息历史记录
Vivox 允许用户使用VivoxService.Instance.GetChannelTextMessageHistoryAsync(string channelName, int requestSize = 10, ChatHistoryQueryOptions chatHistoryQueryOptions = null)channelNamerequestSizechatHistoryQueryOptionsChatHistoryQueryOptionIReadOnlyCollection
以下代码片段的示例说明如何从设置的 LobbyChannelName 中提取最近 25 条消息,然后按从旧到新的顺序记录发送方的显示名称和消息,而无需使用可选的 ChatHistoryQueryOptions。
public async void FetchHistoryAsync(){ var historyMessages = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(LobbyChannelName, 10); //Reversing the messages so they display from oldest to newest var reversedMessages = historyMessages.Reverse(); foreach(VivoxMessage message in reversedMessages) { Debug.Log($"{message.SenderDisplayName}: {message.MessageText}"); }}