Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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!

I have a 1-1 chat app using Parse server. This will help you to start with .https://github.com/faheema/ChatOn

PubNub ChatEngine

PubNub Chat Engine is an object oriented event emitter based framework for building chat applications in Javascript. PubNub Chat Engine makes it easy to build Slack, Flowdock, Discord, Skype, Snapchat, or WhatsApp with ease.

The real time server component is provided by Socket.io or PubNub. PubNub Chat Engine is extensible and includes a plugin framework to make dropping in features simple.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top