Twilio对话API实时聊天
基本上,我只想使用Twilio对话API进行简单的聊天集成。有了文档,我已经设置了一台服务器,我创建了一个对话,并通过上述API端点添加了2个参与者。对我来说,这也很明显,如何创建有关文档的信息。我想知道如果参与者A发送消息,我如何刷新参与者B更新聊天消息。
我需要配置某种Websockets
还是对话API不需要的?我将如何通知参与者B并实时显示新消息?
而且,如果我需要Websockets
,为什么我应该需要Twilio对话API?
basically I just want a simple chat integration by using twilio conversations api. With the docs I already set up a server and I created a conversation and added 2 participants to the conversation itself by the mentioned api endpoints. Its also obvious to me how to create a message looking at the docs. Im wondering how I can refresh update the chat message for participant B if participant a is sending a message.
Do I need to configure some kind of websockets
or is this not needed for the conversations api? How would i notify the participant b and display the new message in real time?
And if I need websockets
, why should I need twilio conversations api then?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们如何实施?
[带有twilio服务器艺术的客户端服务器] [1]
先决条件:
使用的软件包:
How can we implement?
[Client server with twilio server artitecture ][1]
Prerequisites:
Packages Used:
Twilio对话提供 client side sdks 您可以用来显示对话和对话和对话和对话和对话给您的聊天用户的消息。请查看 javaScript对话quickStart QuickStart 您如何查看如何查看您如何可以使用它为您的用户建立聊天。
Twilio Conversations provides client side SDKs that you can use to display conversations and messages to your chat users. Check out the JavaScript Conversations Quickstart to see how you can use it to build chat for your users.
如果您有一个聊天应用程序(这不是实时的,就像您建议使用的那样),那么,在Swift中,如果您实现了Twilio的TchconversationDelegate协议,则可以从那里轻松地在屏幕上更新元素(并将其转换为真实 - 时间聊天)。当添加新消息的是:该功能处理事件的函数(例如 - 将其称为“ WebSocket事件”)是:
此函数与Twilio的Websockets连接到另一端的用户的聊天对话。这就是Twilio对话API的工作方式,如果您正在制作聊天应用程序,我建议您使用它。在此之前,有可编程的聊天,现在已弃用,我不再建议了。
If you have a chat app (which is not real time, like you are suggesting you have), then, in Swift, if you implement Twilio's TCHConversationDelegate protocol, you can easily update elements on the screen from there (and turn it into a real-time chat). The function from the protocol - for example - that handles the event (let's call it a "websocket event") when a new message is added is:
This function is wired with Twilio's websockets directly to the chat of the user at the other end of the conversation. This is how Twilio Conversations API works, and I suggest you use it, if you are making a chat app. Before that, there was Programmable Chat, which is now deprecated and I don't suggest it any more.