XMPP:关于在原始请求者离线时建立相互订阅的 RFC(订阅存在)

发布于 2024-10-10 03:03:54 字数 595 浏览 0 评论 0原文

我们有一个 XMPP 服务器 (OpenFire) 和一个基于 Java Smack XMPP 的自定义客户端堆。我们使用手动订阅接受,因此客户必须交换订阅和订阅状态。

RFC 中所述,订阅状态(“我想订阅您的状态”)由服务器存储,并在用户每次登录时重新发送,直到他回答为止。不幸的是,答案似乎并非如此(“订阅”或“取消订阅”)。如果原始请求者在其他用户回答订阅请求时离线,则他不会收到答复。我在 XMPP RFC 中找不到有关服务器预期行为的任何内容。

我能做些什么?有什么我可能错过的吗?或者是否有一个标准方法来实现这个用例?

这篇 OpenFire 论坛帖子表明我所经历的行为是所需的......

感谢大家的指点, 弗洛里安

we've got an XMPP server (OpenFire) and a custom client based on the Java Smack XMPP stack. We're using manual subscription acceptance, so clients have to exchange subscribe and subscribed presences.

As noted in the RFC, subscribe presences ("I want to subscribe to your presences") are stored by the server and resent every time the user logs in until he answers them. Unfortunately, the same does not seem to be true for the answers ("subscribed" or "unsubscribed"). If the original requester if offline when the other users answers the subscription request, he does not receive the answer. I could not find anything in the XMPP RFC about expected behaviour of the server.

What can I do? Is there something I might have missed? Or is there a standard way to implement this use case?

This OpenFire forum post suggests that the behaviour I'm experiencing is the desired one...

Thanks for all pointers,
Florian

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

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

发布评论

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

评论(2

流绪微梦 2024-10-17 03:03:54

您可以使用两种方法来确定订阅的状态:

  1. 检查请求用户的名册。如果名册包含相关实体的订阅属性为“to”或“both”的项目,则您已订阅。
  2. 第二种选择是向服务器发送另一个订阅数据包;如果其他用户已经接受了存在请求,服务器应该立即响应并代表其他用户进行订阅。

You have two means at your disposal for determining the state of the subscription:

  1. Check the roster of the requesting user. If the roster contains a item for the entity in question with a subscription attribute of "to" or "both" then you are subscribed.
  2. Second option is to send another subscribe packet to the server; the server should respond immediately with a subscribed on behalf of the other user if they have already accepted the presence request.
幸福丶如此 2024-10-17 03:03:54

因此,Alice 想要订阅 Bobs 状态信息并发送订阅请求。服务器将向Bob发送通知,直到他回答。现在您的问题是,如果爱丽丝离线,服务器将不会通知她,而鲍勃会对请求做出反应。所以爱丽丝会偶然得到鲍勃的答案。

如果鲍勃同意交换在线状态信息,爱丽丝会在她的名册上注意到这一点 - 她会看到鲍勃在线状态(离开、空闲、.. .)。否则,她不会知道请求是否仍待处理,或者 Bob 是否拒绝了她的请求。

可以通过实现自定义模块并将其添加到您的 openfire 服务器来更改此行为。 Openfire 有一个用于此目的的 API。

该模块将对确认消息做出反应,并可以向订阅者发送所有待处理或最近确认的订阅消息的状态消息(在每次登录时)。您的客户端代码可以处理这些消息并以适当的方式向订阅者呈现此状态。

So Alice wants to subscribe to Bobs presence information and sends subscription request. The server will send notifications to Bob until he answers with yes or no. And your problem now is, that the server will not notify Alice, if she's offline, while Bob reacts on the request. So Alice will get Bobs answer just by chance.

If Bob agrees to exchange presence information, Alice will notice this on her roster - she'll see Bobs presence (away, idle, ...). Otherwise, she won't know, if the request is still pending or if Bob rejected her request.

It is possible to change this behaviour by implementing and adding a custom module to your openfire server. Openfire has an API for this.

This module will react on confirmation messages and could send a status message for all pending or recently confirmed subscription messages to the subscriber (on every logon). Your client code can handle those messages and present this status in an appropriate way to the subscriber.

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