Reputation: 600
I am learning how to use Firebase and I'm really confused about how you would send a chat message to a specific person in Firebase. Basically what I want to do is have a 2 way chat between 2 people, but other people can make other chats with other friends also. Would you need a new Firebase for each chat?
Upvotes: 1
Views: 1508
Reputation: 2663
if A want to chat with B, A send messages (push) to
http://your-fire-base.firebaseio.com/b_id/ (B's channel)
with content
{sender: a_id, data: some_data}
B will subscribe to his own channel and filter the data based on sender.
Upvotes: 6
Reputation: 599601
You can create nodes under a single Firebase to accomplish most scenarios.
In your case, I'd set up a hierarchy like this:
<root>
Frank-Keiran
<messages>
Keiran-User123
<messages>
Upvotes: 1