XMPP:关于在原始请求者离线时建立相互订阅的 RFC(订阅存在)
我们有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用两种方法来确定订阅的状态:
You have two means at your disposal for determining the state of the subscription:
因此,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.