实时无服务器聊天应用程序的最佳协议\技术

发布于 2024-08-05 17:45:46 字数 223 浏览 1 评论 0原文

我需要将聊天功能嵌入到 .NET 应用程序(Windows 客户端应用程序)中。

要求:

  • 最好是无服务器/零配置架构 (p2p),但不是必需的
  • 基于开放标准(类似 XMPP)
  • 存在 .NET 实现(库)(原生 C/C++ 也可以)

您有什么建议?目前我正在研究 XMPP/Jabber,您有在您的应用程序中使用它的经验吗?

I need to embed chat functionality into .NET application (Windows client app).

Requirements:

  • Preferably server-less/zero-config architecture (p2p), but not required
  • Based on open standards (XMPP alike)
  • Implementation (library) for .NET (native C/C++ is OK too) exists

What can you recommend? Currently I'm looking at XMPP/Jabber, do you have any experience using it in your apps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

雨后彩虹 2024-08-12 17:45:46

呃,如果您确实想为聊天应用程序采用无服务器架构,您需要仔细评估您想要提供什么样的功能。
例如,您只想一对一聊天,群聊、状态通知怎么样,用户身份验证怎么样?
有很多方法可以解决这个问题,但就我个人而言,我总是倾向于使用基于服务器的解决方案。

无论如何,最基本的解决方案是使用UDP多播,每个客户端都是发送者和接收者。 UDP 不可靠,因此您的发送者应该缓存消息,并且您的应用程序级协议应该能够检测间隙、能够请求间隙填充数据并对传入数据进行排序。在这种情况下,基本上每个人都会看到每个人的消息(这可以在应用程序级别协议上进行过滤)。

下一个最佳解决方案是每个客户端发送多播信标(公告),如果客户端有兴趣发起与某个发送者的对话,它将查看信标,其中应包含有关发送者的信息,包括 IP 地址和端口。然后,感兴趣的一方将与信标发送者建立 TCP 连接,这两方现在可以开始直接相互聊天,并保证和有序的消息传递。

我现在可以继续使用更先进的消息传递架构/协议,但我认为这没有意义。

如果我有您的要求,我会得到类似 http://www.coversant.net/Product/ SoapBoxServer.aspx(他们有一个免费的 Express 版本,一切都是用 .NET 构建的,提供 .NET API 等)或获取任何其他 XMPP 服务器(这里有几个:http://xmpp.org/software/servers.shtml) 以及 .NET API,如 http://code.google.com/p/jabber-net/

uhhh, if you really want to do server less architecture for a chat application you need to evaluate carefully what kind of functionality you want to offer.
For example, do you want one-on-one chat only, how about group chats, status notifications, what about user authentication?
there are many ways to go about this, yet personally I would always favor a server based solution for this.

Anyways, the most basic solution would be to use UDP multicast, every client is a sender and receiver. UDP is not reliable, so your senders should cache the messages and your application level protocol should be able to detect gaps, be able to request gap fill data and order incoming data into sequence. In that scenario, basically everybody would see everybody's messages (this could be filtered on the application level protocol).

The next best solution would be that every client sends multicast beacons (announcements) and if a client is interest to initiate a conversation with a certain sender, it would look at the beacon which should contain info about the sender including an IP address and port. The interested party would then establish a TCP connection to the beacon sender and those two parties can now start to chat with each other directly with guaranteed and ordered message delivery.

I could go on now with more advanced messaging architectures/protocols but I don't think that makes sense.

If I had your requirements I would get something like http://www.coversant.net/Product/SoapBoxServer.aspx (they have a free express edition, everything is built in .NET, .NET API provided, etc.) or get any other XMPP server (here's a couple: http://xmpp.org/software/servers.shtml) with a .NET API like http://code.google.com/p/jabber-net/

听闻余生 2024-08-12 17:45:46

我不确定无服务器,因为我托管了 OpenFire jabber 服务器,但是这个 Jabber.NET 图书馆对我来说效果很好。

I'm not sure about serverless, since I hosted the OpenFire jabber server, but this Jabber.NET library worked well for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文