processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.06k stars 1.51k forks source link

How to Find Offline users from MUC chat room #3992

Closed prabhugithubme closed 1 year ago

prabhugithubme commented 1 year ago

Hello Everyone, Use case: Need to send push notification to offline users in Group chat (MUC).

  For that how to find list of offline user's from chat room.

  i have my own method to send push notification so here expecting the list of offline users from chat room. 

p.ls. share if anyone have idea about this.

using Ejabbered version: > = 21.12.0

licaon-kter commented 1 year ago

There's some work about this maybe https://xeps.tigase.net//docs/push-notifications/filters/groupchat/

prabhugithubme commented 1 year ago

@licaon-kter, For push notification i used some custom logic to send. Is there anyway to find offline users like (in one to one chat we can find by this hook "offline_message_hook") .Thank you for your reply.

prefiks commented 1 year ago

Generally speaking there is no offline users in groupchat (users that go offline automatically leave room by sending presence unavailable to it).

There is mucsub (https://docs.ejabberd.im/developer/xmpp-clients-bots/extensions/muc-sub/) that allow user to receive messages even when it's not in a room, user will receive special notification message on new message, which in case user is offline will be stored in mam/offline storage. You usually just add hook that listen for those messages to send pushes.

prabhugithubme commented 1 year ago

For this issue i can see this comment from @mremond commented on Aug 6, 2015 ( https://github.com/processone/ejabberd/issues/697 ) MUC are indeed presence based. It is indeed not designed to care of offline users. The XMPP Standards Foundation started thinking about what is call MUC2, that would make it possible in a clean way.

To be frank, we have done thing for customers but nothing we have the right to share yet. However, we are willing to work actively on the MUC2 approach and have it implemented by following closely the XEP progress.

please share if any update.

And also from the same link i found this https://github.com/diamondbybold/ejabberd_mod_offline_post
and tried to use but when ever this muc_filter_message hook called it's crashing. If anyone succeeded here with latest ejabbered version suggest if any changes needed accordingly for latest version of ejabbered.

prefiks commented 1 year ago

I guess Mickael was talking about mucsub there.

prabhugithubme commented 1 year ago

You usually just add hook that listen for those messages to send pushes.

@prefiks what is the hook name.

prabhugithubme commented 1 year ago

@prefiks i can see the information from Mickael as you said,

1) Reuse XMPP PubSub protocol to manage the subscription and wrap the events received as a subscriber from the room. 2) Rely on Message Archive Management to let client resync history as they need. 3) Rely on existing Push components (ProcessOne extension or XEP-0357: Push Notifications) to send events to mobile devices when application is asleep.

do you have steps to follow to achieve the same. am new to this help me out here if possible. Thank you.

mremond commented 1 year ago

I think the simplest approach is probably to use MucSub: https://docs.ejabberd.im/developer/xmpp-clients-bots/extensions/muc-sub/