XMPP:向 pubsub 添加双向性?

发布于 2024-12-25 18:31:55 字数 322 浏览 1 评论 0原文

我不确定 pubsub 或多用户聊天是否是正确的选择?

我认为我需要的是 pubsub,但还需要订阅者能够向 feed 广播消息。双向信息流,如果你愿意的话。

用例是订阅者平均订阅 1000 个不同的 feed,但每个单独的 feed 平均每周仅广播一次信息。因此,提要很多,但每个提要的活动都很低。然而,由于有 1000 个不同的活动订阅,订阅者每天可能仍会收到 100 条消息的通知,并且他们应该能够“回复”(即发布内容)到这些提要中的任何一个。

看来我需要的是一个 pubsub/多用户聊天混合体。但这并不存在,或者真的存在吗?有什么想法或指示吗?

非常感谢!

I am not sure if pubsub or multiuserchat is the way to go?

What I think I need is pubsub, but with the added ability for subscribers to broadcast messages to the feed as well. Bidirectional information flow, if you will.

The use case is such that subscribers will be subscribed to on average 1000 different feeds, but each individual feed only broadcasts information on average once per week. So, lots of feeds, but low activity in each one. However, b/c there are 1000 different active subscriptions, a subscriber might still be notified of 100 messages per day, and they should be able to "reply" aka post content to any one of those feeds.

It seems like what I need is a pubsub/multiuserchat hybrid. But that doesn't exist, or does it? Any ideas or pointers?

Thanks a bunch!

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

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

发布评论

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

评论(2

唠甜嗑 2025-01-01 18:31:55

如果订阅者正在发布数据,那么他们不仅仅是订阅者,而且是发布者。同一实体没有理由不能同时成为发布者和订阅者。

至于你关于 pubsub 与 MUC 的更普遍的问题,我发现这个问题现在经常出现。

显然乍一看MUC和pubsub非常相似,它们都是关于向一个组广播的。许多应用程序可以轻松地使用其中之一,没有任何问题。

为了帮助确定哪种协议最适合您的应用程序,让我们了解一下这两种协议之间的一些差异。

MUC:

  1. 对于在线用户相互交流的标准聊天室来说绝对有好处。如果这就是您正在做的事情,请使用它。
  2. 包括存在,即通知其他居住者加入、离开和改变状态。
  3. 允许居住者之间进行匿名私人通信。
  4. 几乎可以与任何标准 XMPP 客户端(用于标准聊天消息)一起使用。
  5. 当用户离线或断开连接时自动离开房间。
  6. 支持具有自定义负载的消息,这意味着您只能路由标准聊天消息。

Pubsub:

  1. 一个或几个发布者向许多只读订阅者传输内容是核心 pubsub 领域。与 MUC 相比,订阅者不会发布信息,也不会接收有关其他订阅者的信息。
  2. 服务器实现往往对 pubsub 具有更灵活的访问控制。
  3. 仅自定义有效负载,没有标准聊天消息。
  4. 可选择具有完整的项目持久性。
  5. 节点可以作为项目列表进行管理(即添加/删除通知),而不仅仅是简单的广播。
  6. 订阅可以在离线状态下持续存在。

以上几点仅供参考。通常可以通过服务器配置来实现很多目标。例如,MUC 规范允许房间根据配置拒绝某些类别的占用者的存在广播。这里的问题在于实现......因为这是 MUC 的不常见用法,您会发现许多 MUC 实现可能不支持它。重点是,由于 MUC 是为聊天而不是通用的 pubsub 设计的,因此您会在很大程度上发现围绕 MUC 的所有实现和工具都专注于这种用法。

If a subscriber is publishing data then they are not just a subscriber, they are a publisher. And there is no reason the same entity can't be a publisher and a subscriber at the same time.

As for your more general question about pubsub vs. MUC, that's a question that I find comes up a lot nowadays.

Obviously at first glance MUC and pubsub are very similar, they are both about broadcasting to a group. Many applications could easily use one or the other with no trouble.

To help decide which fits best with your applications, let's go through some of the differences between the two protocols.

MUC:

  1. Is absolutely good for standard chatrooms of online users communicating with each other. If this is what you're doing, use it.
  2. Includes presence, i.e. notifying other occupants about joining, leaving and changing status.
  3. Allows for anonymous private communication between occupants.
  4. Works out of the box with practically any standard XMPP client (for standard chat messages).
  5. Automatic leaving of the room when the user goes offline or disconnects.
  6. Messages with custom payloads are supported, meaning you are limited to routing standard chat messages.

Pubsub:

  1. One or a few publishers transmitting to many read-only subscribers is core pubsub territory. In contrast to MUC the subscribers are not publishing, and are not receiving information about other subscribers.
  2. Server implementations tend to have much more flexible access control for pubsub.
  3. Custom payloads only, no standard chat messages.
  4. Optionally has full item persistence.
  5. A node can be managed as a list of items (ie. add/remove with notification) rather than just simple broadcast.
  6. Subscriptions can persist through being offline.

The points above are just a guide. A lot can typically be achieved through server configuration. As an example, the MUC specification allows for rooms withholding presence broadcasts for certain classes of occupants based on configuration. The catch here is in the implementations... since this is an uncommon usage of MUC, you will find it may not be supported in many MUC implementations. The point being that as MUC was designed for chatting and not generic pubsub, you will largely find all the implementations and tooling around MUC to focus on that kind usage.

似狗非友 2025-01-01 18:31:55

不确定问题是什么。订阅者也只需是发布者即可。没有什么可以阻止他们发布和订阅(除非节点配置为禁止这样做)。

这似乎是一个非常典型的 pubsub 案例。

Not sure what the problem is. The subscriber simply needs to be a publisher as well. There is nothing stopping them from publishing as well as subscribing (unless the nodes are configured to disallow it).

This appears to be a very typical pubsub case.

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