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

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?

Related

How to set up an e-commerce messaging solution using ably.io

I have an e-commerce website and I want to implement a messaging solution between my clients, using ably.io. I am new to ably.io and also to pub/sub message pattern and need some advice to put me on the right track.
Let’s say I have 75,000 users on my website. Users can create an advertisement... if anyone is interested in the advertisement they should be able to message the advertiser.
This is the solution that comes to my mind after reading ably's documentation:
Since I have 75,000 users, I create 75,000 channels, 1 channel per user.
An user named Brian creates an advertisement on the website. Brian subscribes to BrianChannel to receive all messages on his own channel. Now Amy and Tom have seen Brian's advertisement and want to contact him, they publish a message on BrianChannel and Brian would receive the messages.
I am not sure if the above solution is the right approach?
If the above solution is the right way, I have 2 further questions:
Let's Brian uses JavaScript to subscribe to BrianChannel. Now Brian is obviously not online 24/7 - how should I handle his messages while he is offline?
I have 75,000 users registered on my website. At any point of time 5,000 users are online. Out of these 5000 users online, 20 users are actually messaging each other. Using my solution above, I should have 5,000 active channels for all the online users... Is there a way to reduce the number of active channels? Perhaps by periodically polling the channels?
This is Srushtika, Dev Advocate at Ably.
Your approach is correct and is in-fact the most commonly implemented one. i.e, each of your 75,000 users will have their own channels to which only they will be subscribed to. Any other client who wishes to send them a message, will attach to 'their' channel and publish messages to it. Since all users are always subscribed to their own channels, they will be able to receive any messages intended for them.
If any of your subscriber clients are not online at the time a message is to be sent to them, Ably's Realtime platform will, by default, retain it for 2min after which, if the subscriber client is still offline, the messages will be discarded. However, using the Persisted History feature, you can increase the time for which messages are retained to 24-72hrs.
Unfortunately, as of now, Ably doesn't offer a mechanism to detach from channels with no activity while the client is still online. But, this feature is coming soon. Keep an eye on our Engineering blog where we post all such updates.
Hope that answers your question.

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.

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

Whether the gtalk have any limitations on number of contacts or number of messages per minute/hour/day?

We plan to use gtalk for creating chat bot. My question is Whether the gtalk have any limitations on number of contacts or number of messages per minute/hour/day?
I used to run gtalkbots.com which was using google apps infra including jabber service. One of the utility bot called games#gtalkbots.com used to send/rcv about 100-150 chat messages per second at one point without any blockage from google app servers.
Also i think if ever you get such a warning, it will be appropriately told to you with error stanza from google talk servers. Error message should read something like "policy violation" etc... Hope this info helps.....