1
votes

i'm new to PubNub [iOS], i see the tutorial videos and documentation, But i can't understand how the actual process happens I understand this, We create [Pub/Sub] PubNub Channels to receive messages, but these channels are not stored any where in the pubnub, then how to manage an app like WhatsApp (Has groups and Single user chat)

Please suggest how to configure the existing iOS App for PubNub

As i understand i need to create a separate channel for each friend of a user, and separate channel for each user in a group to group is this correct? or please explain the procedure how it should configure in my app

Edit:

I have a question regarding storing and retrieve messages from history

In Case of single user chat:

When User1 sendMessage to User2, i'm Publishing in Two channel as per the Inbound Architecture in the scalabl3

  1. inbound_user2
  2. hybrid_user1_to_user2

When User2 sendMessage to User1, i'm publishing in Two channel

  1. inbound_user1
  2. hybrid_user2_to_user1

But when i've to retrieve the history i need to get history from two channels hybrid_user1_to_user2 and hybrid_user2_to_user1 and need to sort them by timetoken

Can you please tell me that is it is the correct approach or not? if not please suggest

Thanks...

1
Channels are lightweight - you publish to them and you subscribe to them and they exist as they are used. A channel for each user is typical use case as a private channel for sending messages that are only meant for that user (inbox channel), like invites or notifications. A channel for each 1-1 chat and 1 channel for each group chat is also typical. You will likely keep track of these channels somehow on your end (log them to your server DB, locally in each client, etc). If you have a real project, contacting PubNub Support to get on a call with a Customer Success Manager to get started. - Craig Conover
i found this, please check here - anjnkmr
Yes, scalabl3 is a PubNub Solution Architect. Did you have questions about his design pattern? - Craig Conover
@CraigConover, thanks for you response, I updated the question with my doubts, can you please check once - anjnkmr
There are advantages and disadvantages to using a two channel chat design pattern. The disadvantage, is as you point out, you have to get history from two channels and stitch the messages together sorted by timetoken. But yes, that is the right thing to do. - Craig Conover

1 Answers

1
votes

Why not have just one unique hybrid channel that both publish to?

When User1 sendMessage to User2, publish to:

  1. inbound_user2
  2. hybrid_user1_user2

When User2 sendMessage to User1, publish to:

  1. inbound_user1
  2. hybrid_user1_user2

Each user is subscribed to their own inbound channel, and uses the shared hybrid channel to obtain complete history.