powered by Jive Software

PubSub - Subscribing to a Collection Node

Morning Ladies & Gents,

I’ve got a small PubSub hierarchy. My intention is to have a client subscribe to a collection node so that it receives any items published to one of its leaf nodes. I’ve successfully been able to subscribe to a LeafNode, but when I attempt to do the same to a CollectionNode, I don’t get any errors but I don’t get any items either (the Listener just patiently waits.)

Nothing in the XEP-0060 doc suggests I can’t do this.

The Smackx PubSub document states that the current API only supports LeafNodes (it isn’t specific about subscribing or publishing - just says only LeafNodes are supported full stop.) This doesn’t appear to be true: this forum describes how to create the hierarchy (which I have done successfully); and I have a recursive method that starts at the root of the tree and prints the name of all the children nodes — so I have verified that the tree structure is anticipated.

The Smackx PubSub documentation is very light about CollectionNodes (and deleting nodes too - I might add.) It appears to be old / out of date (not griping - I appreciate its a community effort, I’m particularly grateful for the APIs at all - its just I have tried to ‘RTFA’)

I’ve also attempted to listen on a CollectionNode and have a child LeafNode change; as well as more nested ones. I spotted the level property on another post (since misplaced the link), I’m not setting in any configuration form a level property (either all or 1) - so I tried listening in both cases to be sure.

I’m grateful for any help you can provide. Thanks in advance,

Sam
snippet.java.zip (387 Bytes)

I’ve been able to verify that the user has been subscribed to the CollectionNode (different from the owner, owner is also publisher).

I also have tested the following scenario: subscriber is only subscribed to the CollectionNode, not the LeafNode. (NB, the LeafNode has been verified to be a child of the CollectionNode). —I had been concerned that multiple subscriptions at different nesting levels would affect listener receiving updates.

The thread at: http://community.igniterealtime.org/thread/49758 provides code for using a SubscribeForm with two additional custom FormFields - one for subscription type (must be items) and another for subscription depth (1 or all).

Implementing this resolved the issue.