XMPP 和 Google App Engine 通道 API 之间的差异
我正在开发一个不驻留在 AppEngine 上的应用程序,并且具有放入通信 Web 客户端(浏览器 + javascript)和移动客户端(ActionScript)中的聊天功能。 我正在考虑在 AppEngine 上使用 XMPP 协议(然后仅使用 Google 上的聊天功能服务器,并将其余部分保留在我的服务器上)。你告诉我这是否可能? 与 Channel API 有什么区别? 谢谢
I am developing an application that doesn't reside on AppEngine and having the functionality of a chat putting in communication web clients (browser + javascript) and mobile clients (ActionScript).
I'm thinking of using the XMPP protocol on AppEngine (then use only the servers for the chat feature on Google and still leave the rest on my server). You tell me if this is possible?
What are the differences with the Channel API?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
XMPP 和 Channel API 解决了堆栈的两个不同级别的问题。
XMPP 描述了一种从一个端点向另一个端点获取消息的通用方法。存在适用于 Windows、Linux、OSX 等的现有 XMPP 客户端,并且存在编写为 C++、Python、
Channel API 描述了服务器端发送消息的方法和客户端接收消息的方法。 App Engine 实现提供了一个 JavaScript 客户端,这对于 Web 应用程序来说是棘手的部分,因为它需要持久的 HTTP 连接。您当然可以使用您喜欢的任何方式在另一个平台上重新实现 Channel API(对于 App Engine,我们使用 Google Talk 堆栈;后端使用 XMPP,前端使用长轮询 HTTP 连接上的 JSON)。
根本问题是您的实现需要多少抽象。 Channel API 比 XMPP API 抽象了更多内容,并提供了一个客户端库来简化通过 javascript 的连接。
XMPP and the Channel API solve problems at two different levels of the stack.
XMPP describes a generic way to get a message from one endpoint to another. There are existing XMPP clients for Windows, Linux, OSX, etc. and there are existing XMPP client libraries written C++, Python, javascript, etc. If you just want to deliver text to a user who you know already has an XMPP client, using the XMPP App Engine API is the obvious solution; if you want to have tons of control over the client experience and have time to spend on it, using an existing XMPP library and making a custom client could be a good choice.
The Channel API describes a server-side method for sending messages and client-side method for receiving messages. The App Engine implementation provides a javascript client, which is the tricky part for a web app because it requires a persistent HTTP connection. You could certainly re-implement the Channel API on another platform using whatever means you'd like (for App Engine we use the Google Talk stack; XMPP on the backend with JSON over a long-poll HTTP connection on the frontend).
The fundamental question is just how much abstraction you need for your implementation. The Channel API abstracts away much more than the XMPP API, and provides a client library to make connection over javascript easy.
据我了解 ChannelAPI 是 Google XMPP 服务背后的支柱。如果您想在客户端的 JavaScript 和 GAE 上托管的 Web 应用程序之间异步发送/接收(服务器推送)行 JSON 对象,那么 ChannelAPI 是最佳选择。
As far as I understand ChannelAPI is a backbone behind Google XMPP service. If you want to asynchronously send/receive (server push) row JSON objects between client's JavaScript and your Webapp hosted on GAE, then ChannelAPI is the way to go.
Channel API 使用 XPC 通过 IFrame 与 Google 的 GTalk 客户端进行通信。该客户端促进浏览器和您的应用程序之间的双向通信。为您提供的 JavaScript 库松散地映射到当前的 WebSocket 的 API,并且应该可以轻松过渡从 Channel API 到 WebSockets,一旦/如果 AppEngine 支持的话。
我相信 XMPP 是 Channel API 的支柱,并且是功能的超集。例如,XMPP API 支持邀请,
因此,是的,您可以使用 Channel API(浏览器)和 XMPP(无处不在)来构建聊天功能。
Channel API uses something called XPC to communicate to Google's GTalk client via an IFrame. This client facilitates bi-directional communication between the browser and your App. The JavaScript library that's provided for you, is loosely mapped to the current WebSocket's API and should ease transitioning from Channel API to WebSockets, once/if it's supported on AppEngine.
I believe that XMPP is the backbone for the Channel API and is a superset of features. For example, the XMPP API has support for Invitations
So, yes you can use the Channel API(browser) and XMPP(everywhere) to build chat features.
XMPP API 促进您的应用程序和 XMPP 客户端(例如 Google Talk)之间的通信。
Channel API 用于使用 Web 套接字将数据从您的应用程序推送到 Web 浏览器。
两者都可以用作聊天应用程序的一部分;选择仅取决于聊天客户端是使用 XMPP 客户端还是 Web 浏览器。
The XMPP API facilitates communication between your app and an XMPP client, like Google Talk.
The Channel API is used to push data from your app to a web browser using web sockets.
Either can be used as part of a chat app; the choice just depends on whether chat clients are going to be using an XMPP client or a web browser.