How to manage PubSub notifications send while offline in XMPP?
Asked Answered
A

1

10

How to get offline message in PubSub? Using the Smack library. after searching I found an answer which looks like this:

// Create a pubsub manager using an existing XMPPConnection
PubSubManager mgr = PubSubManager.getInstanceFor(con);

// Get the node
LeafNode node = mgr.getNode("testNode");

List<? extends Item> items = node.getItems(100);

But node.getItems(100) returns last 100 messages, which can be online and offline too.

1) how to keep track of online and offline message in pubsub using smack?

2) is it possible to get unread message count in pubsub using smack? if yes then how to achieve it?

3) how to know that who(publisher) send this message in a node?

I just went through the documentation of Smack and PubSub from here and here but didn't find the solutions related to my queries. So can anyone help me to solve this?

Antoninaantonino answered 28/9, 2017 at 11:16 Comment(0)
I
3

1) how to keep track of online and offline message in pubsub using smack?

I would suggest using the PubSub item ID.

2) is it possible to get unread message count in pubsub using smack? if yes then how to achieve it?

PubSub nodes don't have a per subscribed unread message count.

If you want to catch-up on all new items since you received the last item from a PubSub node, you'd usually remember the last item's ID and use that to query for all newer items on the PubSub node. Unfortunately there is (currently) no way to query a PubSub node for newer items after a certain ID.

But if you are subscribed to a node, then the service will notify you about new items even if you are offline. And if your server stores those offline messages for you, then you will receive them eventually.

3) how to know that who(publisher) send this message in a node?

Unfortunately there is no reliable way to the the JID of the entity which published an item. This too, could probably be fixed with an extension XEP.

Ideation answered 9/10, 2017 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.