Page 1 of 1

group chat

Posted: 27 Aug 2011, 13:19
by jason_
What's the best way to implement a group chat functionality?

Posted: 27 Aug 2011, 13:36
by rjgtav
Hi. Well, it depends of if you want or not everyone to see everyone's else chat.

If you want everyone to be able to see everyone's else chat, well... that's not advisable... but i think the best way will still be only 1 room for handling everyone. To improve the performance you would need to disable some of the events and limit the max rate an user can send a msg.

If you only want to group people in smaller rooms, but still be able to change between rooms, the best way is to have many rooms (with not too much users each) and all in the same room group (in case you want to receive updates from the other rooms such as user enter and leave, etc).

But this also depends of what other features will you add to the chat...

Posted: 28 Aug 2011, 01:26
by jason_
Thanks for the reply. my intention is to have a tab for public chat, a tab for private chat and a tab for a group chat where a specific group of users can chat separately from the public chat.

Posted: 28 Aug 2011, 06:13
by jamalsoueidan
There is two options you can go for.

The easy one is.

10 tabs for 10 rooms, some rooms for only 2 and other rooms for 20 users.

So people who want to talk alone can join room with limit 2 users.

This is easy task and you can do it easily.


The hard part to make it dynamic, then you need more time and code :)
The best thing to do is to start with the easy task, when you are done with the interface and working chat rooms.

BY THEN you can start working on advanced chat while your other simple chat is LIVE online :D

Posted: 28 Aug 2011, 09:30
by rjgtav
hi. So for the public tab, you can create rooms with around 20 - 30 people.
For the private tab, you dont really need to create a room, as you can easily send private messages to users between different rooms.
For the group tab, you create smaller rooms and, if the group chat is private, you set a password to that room, so only people known people can enter.

Posted: 28 Aug 2011, 14:08
by jason_
Is there a way to join two rooms at the same time and listen to public chat events on both rooms?

Posted: 28 Aug 2011, 16:44
by jamalsoueidan
Yes, you just subscribe to the other room or zone :D

Posted: 29 Aug 2011, 19:04
by jason_
for some reason I'm only able to get PUBLIC_MESSAGE events from one room even after I joined and subscribed to a second room. Any thoughts?

Posted: 29 Aug 2011, 21:26
by rjgtav
Hum... Sorry on mobile now. Can you post the steps u're doing?

Posted: 29 Aug 2011, 22:17
by jamalsoueidan
Example:

getApi().subscribeRoomGroup(user, "roomName");

Posted: 30 Aug 2011, 17:57
by jason_
Cool. I'm able to recieve public messages from two different rooms using subscribeRoomGroup() method.

My next question is how do I figure out which room the chat message is coming from?

Posted: 30 Aug 2011, 18:07
by rjgtav
Hi. Please check the docs before posting.
In the PUBLIC_MESSAGE event details, you can see that there is a property called Room, which is the Room object from where this public message was originated.

I know it says that it is "An object representing the Room at which the message is targeted.", but that's because when you send a public message, you choose to which of the joined rooms you want to send it to.