Xamarin C# SDK 中的 Quickblox 聊天设置 save_to_history 为真
Quickblox chat setting save_to_history to true in Xamarin C# SDK
我正在使用 Quickblox C# SDK. I want to send message to a specific dialog. It's not well documented in Xamarin specific documentation. I decided to visit REST API documentation。我可以从那里学到
By using Chat 2.0, you are not automatically storing your messages. Also a dialog entity won't be created/updated without saving a message to history.
我可以推断如果我将save_to_history
设置为1,将自动创建聊天对话框并将消息存储在后台。但是我无法弄清楚我应该如何在 C# SDK 中指定它,因为此方法签名
中的 extraParam
public void SendMessage(int userId, string body, string extraParams, string dialogId, string subject = null, Quickblox.Sdk.Modules.ChatXmppModule.Models.MessageType messageType = Quickblox.Sdk.Modules.ChatXmppModule.Models.MessageType.Chat)
只是一个字符串。我研究了反汇编代码,经过一番调查后了解到这个参数在内部用作 XML 所以我尝试了这两个选项
var extraParams = "<extraParams> " +
"<save_to_history>1</save_to_history> " +
"</extraParams>";
还有
var extraParams = "<save_to_history>1</save_to_history> ";
但是其中 none 有效。
有人知道我应该如何指定 extraParam 吗?
此致
问题很简单,我在发送消息之前忘记调用 connect。
下面是发送消息的方法
public async Task SendMessageAsync(IUser sender, IChatMessage message, string channelID, CancellationToken token)
{
await loginIfRequired(sender, token);
var jsonMessage = JsonConvert.SerializeObject(message);
var recipientID = await getQuickbloxUserId(message.RecipientID, token);
var extraParams = "<extraParams> " +
"<save_to_history>1</save_to_history> " +
"</extraParams>";
_quickblox.ChatXmppClient.SendMessage(recipientID, jsonMessage, extraParams, channelID);
}
里面loginIfRequired
我叫
_quickblox.ChatXmppClient.Connect(_currentUserID.Value, password);
一切正常,对话框已创建。
希望这会对某人有所帮助。
我正在使用 Quickblox C# SDK. I want to send message to a specific dialog. It's not well documented in Xamarin specific documentation. I decided to visit REST API documentation。我可以从那里学到
By using Chat 2.0, you are not automatically storing your messages. Also a dialog entity won't be created/updated without saving a message to history.
我可以推断如果我将save_to_history
设置为1,将自动创建聊天对话框并将消息存储在后台。但是我无法弄清楚我应该如何在 C# SDK 中指定它,因为此方法签名
extraParam
public void SendMessage(int userId, string body, string extraParams, string dialogId, string subject = null, Quickblox.Sdk.Modules.ChatXmppModule.Models.MessageType messageType = Quickblox.Sdk.Modules.ChatXmppModule.Models.MessageType.Chat)
只是一个字符串。我研究了反汇编代码,经过一番调查后了解到这个参数在内部用作 XML 所以我尝试了这两个选项
var extraParams = "<extraParams> " +
"<save_to_history>1</save_to_history> " +
"</extraParams>";
还有
var extraParams = "<save_to_history>1</save_to_history> ";
但是其中 none 有效。 有人知道我应该如何指定 extraParam 吗?
此致
问题很简单,我在发送消息之前忘记调用 connect。 下面是发送消息的方法
public async Task SendMessageAsync(IUser sender, IChatMessage message, string channelID, CancellationToken token)
{
await loginIfRequired(sender, token);
var jsonMessage = JsonConvert.SerializeObject(message);
var recipientID = await getQuickbloxUserId(message.RecipientID, token);
var extraParams = "<extraParams> " +
"<save_to_history>1</save_to_history> " +
"</extraParams>";
_quickblox.ChatXmppClient.SendMessage(recipientID, jsonMessage, extraParams, channelID);
}
里面loginIfRequired
我叫
_quickblox.ChatXmppClient.Connect(_currentUserID.Value, password);
一切正常,对话框已创建。 希望这会对某人有所帮助。