为什么我们应该将XMPP而不是JSON用于简单(仅文本)消息传递应用程序?

时间:2022-09-11 18:47:31

I am creating a simple Android chat app with groups, chat history etc., but "text only".

我正在创建一个简单的Android聊天应用程序,包括群组,聊天记录等,但“仅限文本”。

I have backend developer in Node.js. Googling we found out that XMPP (XML) is the protocol for large scale chats, but for small to medium chat apps (mobile), I believe we can go ahead with JSON and Node.js server.

我在Node.js中有后端开发人员。谷歌搜索我们发现XMPP(XML)是大规模聊天的协议,但对于中小型聊天应用程序(移动),我相信我们可以继续使用JSON和Node.js服务器。

Want to know if there is any significant advantage on using XMPP?

想知道使用XMPP是否有任何显着优势?

2 个解决方案

#1


2  

It is not about simple text message. When you want to implement real time chat application you have to notify the all the user of chat window when their is a new message post in thread.

它不是简单的短信。当您想要实现实时聊天应用程序时,您必须在线程中的新消息发布时通知聊天窗口的所有用户。

The one way to notify other user is through push notification which is generally not that much reliable. So we use XMPP protocol for that. Find more details about XMPP here.

通知其他用户的一种方式是通过推送通知,这通常不太可靠。所以我们使用XMPP协议。在此处查找有关XMPP的更多详细信息。

If you don't want to use XMPP protocol then you can achieve the same using socket. And in android their is socket.io is available which is also a good library for real-time chat.

如果您不想使用XMPP协议,那么您可以使用套接字实现相同的功能。在android中他们的socket.io是可用的,这也是一个很好的实时聊天库。

#2


1  

If implementing XMPP, your users may use XMPP clients of their preference to chat on your server. This way you also reach users on platforms other than Android.

如果实施XMPP,您的用户可以使用他们偏好的XMPP客户端在您的服务器上聊天。这样,您也可以在Android以外的平台上覆盖用户。

#1


2  

It is not about simple text message. When you want to implement real time chat application you have to notify the all the user of chat window when their is a new message post in thread.

它不是简单的短信。当您想要实现实时聊天应用程序时,您必须在线程中的新消息发布时通知聊天窗口的所有用户。

The one way to notify other user is through push notification which is generally not that much reliable. So we use XMPP protocol for that. Find more details about XMPP here.

通知其他用户的一种方式是通过推送通知,这通常不太可靠。所以我们使用XMPP协议。在此处查找有关XMPP的更多详细信息。

If you don't want to use XMPP protocol then you can achieve the same using socket. And in android their is socket.io is available which is also a good library for real-time chat.

如果您不想使用XMPP协议,那么您可以使用套接字实现相同的功能。在android中他们的socket.io是可用的,这也是一个很好的实时聊天库。

#2


1  

If implementing XMPP, your users may use XMPP clients of their preference to chat on your server. This way you also reach users on platforms other than Android.

如果实施XMPP,您的用户可以使用他们偏好的XMPP客户端在您的服务器上聊天。这样,您也可以在Android以外的平台上覆盖用户。