チャット履歴
Retrieve and manage chat message history.
読み終わるまでの所要時間 1 分最終更新 23日前
チャンネルテキストメッセージの履歴
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}"); }}