Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android chat application guidance using Parse and PubNub

I am trying to create a simple Android chat app where a user can sign up and have a friends list to start conversations. I am planning on using Parse for the database backend and PubNub for the actual chat channels.

I do not have much experience with this kind of an App. I have an idea of what needs to be done but just wanted an opinion from someone who has some experience.

Here is the model that I am planning to implement:

  • The User profile info collected on sign up page will be stored in a table in the Parse database
  • All the user-friends associations will be stored in a table in Parse
  • Once a user selects a friend to start chat, a new PubNub channel should open up and that channel name should be stored in a table in Parse (This table contains all active channels/chats)

Does this look like I am heading in the right direction? Or can something be done better? Or is there any other service that I could be using?

like image 977
Ayrton Senna Avatar asked Jan 15 '14 01:01

Ayrton Senna


2 Answers

This approach would work. You could create a channel for every user pair. You may not need to necessarily store the channel in parse. You could just have a naming convention - something like channel_user1_user2 In addition to standard publish/subscribe, I would also suggest using history api to catch up with chat messages that the user may have missed since the last connection. Also, you can use pubnub presence api to determine if any of the users are online

The android example at https://github.com/pubnub/java/tree/master/android shows how to use publish/subscribe and history

like image 107
Bhagat Nainani Avatar answered Sep 17 '22 04:09

Bhagat Nainani


I have put together an open source instant messenger for Android that uses Parse and Pubnub here https://github.com/WizTheEngineer/DroidMessenger. Hope this helps!

like image 41
Wayne J. Avatar answered Sep 19 '22 04:09

Wayne J.