Conversejs groupchat subscriptions (ejabberd) - publish-subscribe

I have been struggling to configure a group chat using conversejs and ejabberd. From the documentation I've stumbled across, it seems like it is possible to have a persistent group chat that users can be subscribed to, which will allow them to receive messages from the group chat while not present in the group chat.
For example: I would like to be able to simply close the group chat on my conversejs client, but still get notifications from that group chat.
This is a fresh ejabberd 21.04 and conversejs 7.0.6 install (using websockets).
What I tried to do was create a room through the conversejs client, and then add a subscription through the ejabberd cli:
ejabberdctl subscribe_room user#my.example.com/muc user test_room#conference.my.example.com urn:xmpp:mucsub:nodes:messages
One of the things I'm most confused by is the field in the configuration panel of a group chat that is titled "XMPP URI of Associated Publish-Subscribe Node." I have no clue how to format this, but have found a few clues online... What I have tried is a number of different configurations of something like:
xmpp:my.example.com?;node=messages
but I'm really just grasping at straws here.
If anyone can help me figure out what I'm doing wrong with this URI, or can show me a working example of this, that would be amazing. If what I'm trying to do simply isn't possible with XMPP, please let me know as well.
Thanks!

it is possible to have a persistent group chat that users can be subscribed to, which will allow them to receive messages from the group chat while not present in the group chat.
Exactly.
ejabberdctl create_room room1 conf.localhost localhost
ejabberdctl change_room_option room1 conf.localhost persistent true
ejabberdctl change_room_option room1 conf.localhost allow_subscription true
ejabberdctl subscribe_room user1#localhost User1 room1#conf.localhost urn:xmpp:mucsub:nodes:messages
Now I'll use the send_message API call to send a message to the room. This requires the sender to be online, so for this example register and login to admin#localhost. And of course, login to user1#localhost to receive the notification from the room. Those clients do not need to join the room.
ejabberdctl send_message groupchat admin#localhost room1#conf.localhost Sub Body

Related

From XMPP and RabbitMQ what should i use for group chat?

I am developing a chat application for android and i phone . Here i am to make persistent groups like whatsapp where members remain joined even after they get offline and after getting online they get their offline group messages. As it is not possible with XMPP so i am thinking about to go for rabbitmq and ejabberd both.
Here is how i want to make group-
When a group is created , an exchange is created in rabbitmq and each group members will add this user to its roster.
Now when a user send a message to rabbitmq then it will be delivered to members who are subscribed to that exchange and offline messages will remain in the queue till user gets online.
My Questions are-
Is it the correct way which i am thinking?
How much exchanges can we create in rabbitmq and how much memory an exchange takes ?
How much messages a queue can store and how much memory it takes?
Should i use it or simply go with XMPP-MUC for group chat?

allow members to search for chat rooms they belong in XMPP with Smack API

I'm creating a chatroom website were each user can create a room and add his friends to that room and then start chatting!:D I'm using XMPP as the tool for this site with ejabberd server and smack API as client for room configuration! as you've already understood rooms are member only but I'm looking for a way to let each user see all rooms that she is a member of!
is it possible with xmpp protocol(to get all rooms that I'm member of)?how?
Does making the rooms public solve the problem? BTW how can I do it with smack API?
or better say, how can I choose to set a room public or hidden
thanks in advance
No, it is not possible in XMPP. This has been asked before, see: Is there a way to determine which Mulit User Conferences (MUC) a user has joined?
You could however keep track of these rooms yourself in a separate data store each time an user would enter (and/or leave) the room, but this is outside the scope of XMPP as mentioned earlier.

OpenFire - Permanent Group Chat using PubSub

First from this question :
Asmack/openfire How do I keep a user permanently in groupchat room
I read that I cannot use MUC to keep the user persistent in the group, they'll automatically leave the group and can rejoin after they come online again, that concept is like IRC like what've been asked in here -> http://community.igniterealtime.org/thread/48020.
Then from the stackoverflow question I read about using pubsub, then I've done some research about pubsub and what I've got is pubsub can persist the user to be in the group even the user is offline but the message flow is more like one directional from the publisher to the subscriber (read-only).
So if I want to create a group chat application can I use pubsub and set all the member to become both publisher and subscriber? or is there any alternative solution?or my understanding of the pubsub and MUC is incorrect?
my goal is to create some group chat like in the whatsapp or blackberry messenger group.
Thanks.
You can make users permanent in Group chat in MUC by changing the following code of openfire.
File : src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
change line 547-550:
// TODO Consider that different nodes can be creating and processing this presence at the same time (when
remote node went down)
removeRole(group);
role.getChatRoom().leaveRoom(role);
TO:
// TODO Consider that different nodes can be creating and processing this presence at the same time (when
remote node went down)
// TODO Dont remove user from group when they go offline.
//removeRole(group);
//role.getChatRoom().leaveRoom(role);

Candy webclient with Openfire, not working complete

I have set up the Openfire xmpp server and it's running good from a client, but i want to use candy with it to create a chatroom (muc), my settings in openfire work and so there is a conference.blabla.nl, that conference server i can connect with Pandion and Tkabber, i log in and ask what rooms are there or if i want to create one myself, that all go well.
When i connect with candy it only connects as i use a proper login name and pass, but i want it to join or create a chatroom on the muc.
When i login with proper username and pass my screen gets grey, but when i type something to the user logged in at candy there will appear that there are messages but only then, i can't read them in candy...
So to go short, i have candy up and running but shows only information when someone sends something.
Anyone knows about it or have some good tips what could work.
I just want a webclient that people can use with a own chosen name like "guest" or something and then log in to the chatroom.
Any help appreciated.
There are three possible options:
On initialization of Candy, specify autojoin with "true" and in the openfire server specify autojoin bookmarks.
On initialization of Candy, specify autojoin with an array of rooms to autojoin
use the roomPanel Plugin to discover existing rooms and be able to join them.
Btw. we have a support mailinglist as well

How to configure XMPP to allow all logged in user to see each other and chat with each other?

I am new to XMPP.
I am using Openfire server, and created a console client using Smack library.
My usecase:
All users anonymous, logged in (In future, website visitors) will be able to see other anonymous, logged-in users. And they can initiate a private chat (one-to-one) with any of them.
So, I am able to logged in as Anonymous user, but I am not able to see other Anon / Logged in users (using Roster), because they are not in anon user's roster.
So, What should be configuration OR custom=component/code to to achieve this usecase?
Do I need to create server component? Any hint? OR
It can be done using proper configuration?
Cheers
You should create Multi chat room MUC, and join users after login to this room.After user joins muc room they can get paricipiants list.