OpenFire - Permanent Group Chat using PubSub - xmpp

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);

Related

How to send notifications to an offline member deleted from a chat group?

I am new to XMPP and working on a group chat application similar to watsapp. The scenario is:
"User A creates a group chat adding users B, C and D to it. All members are online and they are chatting. Now D takes the app to background or kills the app. Now A removes D from the group. How user D will be notified that A has removed him from the group, when D comes back to the app ?
I am using ejabberd (15.11) with PostgreSQL and following the XMPP architecture. I am not sure if the answer is out there, so would like to get help here.
XMPP MUC specifications says in section 9.5: Modifying the Member List:
If a removed member is currently in a members-only room, the service
SHOULD kick the occupant by changing the removed member's role to
"none" and send appropriate presence to the removed member as
previously described. The service MUST subsequently refuse entry to
the user.
It means that the participant will only receive his own status change modification if it is present it the room when the event happen. If he is not online at that time, he can only know his credentials has been removed, because he cannot join the room anymore. In other words, in the current state of the specifications, there is no way to get that removal notification when user was not in the room when the removal happened. You can just infer he was removed because he cannot join the room again on next login.
There is nothing else defined in XEP-0045 Multi-User Chat to store membership event for offline participant and later delivery.

Is there any way to add custom command processor to xmpp char rooms for voting?

I'm very new to xmpp and jabber services.
I try to add voting ability to jabber chat rooms. What is the best way to do it?
I know, there are some bots written for jabber.
I have openfire server. I think, bot can be added to every chat room, created on server, but what is the way to store voting results, for example.
Case:
Chat room is created
Users are added
Bot is added to room
Bot reads messages and when it gets
/voting firtree:'FirTree decoration' 1:'red balls' 2:'green balls'
Voting is created
User sends
'/vote firtree:1'
and his vote goes to 1st variant of firtree voting.

RabbitMQ Structure For Private Messaging

I am currently looking to buildout a messaging service where users can send and receive messages privately between each other. I may have a need for multi-user chat, but for the most part, I only want single recipients to be able to read messages sent to them.
With looking at RabbitMQ, does it make sense to use one exchange, and create a queue for each user when they login and destroy each queue on logout? Are there major performance issues with creating a queue for each user or are there better alternatives?
I am building a REST API and plan on having users send messages to others through an endpoint (/send) and subscribe to their own message streams via websockets or something similar. I will probably store messages in MongoDB as well, so users can access all of their previous messages. Any suggestions on structure are appreciated.
I think your approach is correct. You event don't need an exchange if you will use the default exchange (AMQP Default). And during login create a new queue and keep queue name same as user name. (Just need to make sure user names are unique) And if you publish message to the default exchange with username (ie: queue name) as routing key, RbbitMQ will route that message to that queue only. And on logout if you delete the queue then user is going to miss the messages when he is not online. If it is OK then create queue after login and use the configuration exclusive which says queue gets deleted when there is no consumer. But if you want to keep offline messages then you need to create queue permanently during user signup.

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?

On presence receiving published item twice ejabberd

I am developing a xmpp client and currently working on "pubsub".
I created a node in pubsub and subscribed two users to it.
But when a subscriber login(show presence) i get the last published item twice.
I am using ejabberd server.
Can anyone help??
Thank you.
Same here,
There seems to be two different queues. With notification_type=normal, messages are stored offline. When receiver becomes online, it receives the message twice:
from offline spool, without headline attribute
from pubsub send loop (as node is still configured with send_last_published_item = on_sub_and_presence)
As stated here when configuring pubsub node with notification_type=normal, it's best to disable send_last_published_item or set it to on_sub only in order to avoid receiving the message twice.