The community forums are in BETA and closed to the public.

Facebook + PubNub = Chat in Dating App.

I want to create a dating app that:

  1. User login into my dating app using Facebook login.
  2. Get his/her profile pictures.
  3. List all presence users of my dating app and see pictures of each users.
  4. Select a presence user to chat 1:1.

My questions are:

  1. How to bridge Facebook login and PubNub?
  2. Do I have to create my own database to store info of all users who signed into my app? So that the database can store their FacebookID and pictures.
  3. Use this FacebookID to add it into a mydatingapp channel so that everybody else in the channel can see him/her. But how can other people in the channel see his/her pictures? Does it mean that when I see some user with an unique FacebookID joins the channel, I'll have to write my own logic to retrieve the pictures of that given FacebookID from my own database?
  4. Create a private channel for 1:1 chat, how to show the avatars of the two users in that private channel.
  5. How does be used to simplify the logic that I have to write myself?

Just some quick advice (where PubNub applies) using JavaScript references/docs:

  1. Define "bridge". If you mean login, then there is really nothing applicable in PubNub since there is no "logging in" to PubNub. You implement authentication in your app like any other app. Once authenticated, you might authorize users to publish or subscribe to certain channels by granting access on an auth-key that your server provides the end user to initiate a connection to PubNub. This auth-key will limit that user to the channels they are granted access to for the purposes of publishing and subscribing. See more on Access Manager here.
  2. This applies to #1 - yes, you need to create your own database to store the user's profile. This is where you would bridge FB to your app, but not directly to PubNub. Authentication using FB would lead to getting the authorizations (access privileges) from the user's profile.
  3. Yes, you will retrieve the FB pic and display it in your app based on who is subscribed to a particular channel using Presence and the here_now API. The pictures don't have to live in your database as you can pull them directly from FB and maybe cache them locally.
  4. Showing the avatars in the private chat is just a UI thing. PubNub need not be involved but it could be. You would just generate a new channel for the two users to pub/sub on or you can use the private channels where each user sends messages to the other on the other's private channel. But the pictures/avatars would just be pulled from FB like above. If you needed a simple way to provide the URL to an image file, you could set this in the user's state on that channel.
  5. Parse might simplify your database implementation. But I am not familiar with Parse's full API offering. I do know that their server side JavaScript API is special and is not compatible with most other third party JavaScript APIs, including ours. So if you had any server side PubNub implementations you need to implement, you would have to use our REST API.

See this blog for more details on integrating with Parse.

I am certain you have some follow up questions, so feel free to ask and dig deeper on any of this.

Hey Thuyen,

Check out my pubstrap-chat example here, which involves Facebook and PubNub.

For private channels, consider this example:

Login or Signup to post a comment