我正在使用Twilio发送消息,代码如下:
string channelId = <channelId>;
string serviceSid = <servicesid>;
IpMessagingClient ipMessagingClient = new IpMessagingClient(<accountid>, <token>);
var msgResult = ipMessagingClient.CreateMessage(serviceSid, channelId, "sender", "message");
msg.Body = "body"
msg.DateSent = DateTime.Now;
msg.Sender = "sender"
return Json(new
{
Success = msgResult.Sid != null,
NewMessage = msg
});消息发送正常,我可以检索通道的消息。我现在正在尝试实现的是其他打开的浏览器,并在通道中收到新发送的消息的通知,以便我可以更新UI以显示新消息,而无需手动刷新浏览器。
发布于 2017-01-09 18:59:07
Twilio开发者的布道者在这里。
看起来您正在使用REST API向可编程聊天API发送消息。
为了开始使用客户端版本,特别是JS客户端,我会通读Programmable Chat documentation,下载JS SDK并查看the code for the reference chat demo。所有这些都应该为你为客户端建立聊天打下良好的基础。
如果有任何帮助,请告诉我。
https://stackoverflow.com/questions/41543459
复制相似问题