سؤال

I'm building an XMPP client in Python. The client needs to get notifications from multiple pubsubs. During session initialization, the client must bind to a resource.

For example, the client could bind to pubsub.sales.

<body rid="34314915"
      sid="fe63566533334135bb2edf70b80a62743416b584"
      xmlns="http://jabber.org/protocol/httpbind">
  <iq id="KVwaFGvr+M53"
      type="set"
      xmlns="jabber:client">
    <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
      <resource>pubsub.sales</resource>
    </bind>
  </iq>
</body>

When I do that, the client only gets messages from the resource to which it is bound. How can I get notifications from other pubsubs?

هل كانت مفيدة؟

المحلول

The problem was related to presence. Here is what the client was sending:

<body rid="34314917"
      sid="fe63566533334135bb2edf70b80a62743416b584"
      xmlns="http://jabber.org/protocol/httpbind">
  <presence xmlns="jabber:client">
    <priority>-1</priority>
  </presence>
</body>"""

When priority is negative, the client only receives notifications sent to the full JID. I set the priority to 7 and now the client gets notifications from the all pubsubs that are subscribed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top