D
D
DeNissss44442020-12-11 23:23:02
Android
DeNissss4444, 2020-12-11 23:23:02

How to implement a chat in firebase so that 2 people would sit in it, and not 10 at a time.?

O wisest developers, help a beginner who wants to reach your level. The bottom line is, I am writing a dating application, it has a chat and at the moment as many people as 10-15 can connect to it, in firebase only one room is allocated for this chat. And what I need is:
1. There were only two interlocutors in it. If 2 more people enter the chat, they go to another room.
2. For each such pair of interlocutors, a room should be automatically created in the firebase.
3. If the user wants to save the dialog, he presses the save button and this dialog is added to another fragment called "My Dialogs". Accordingly, this room is copied from firebase, transferred to another firebase section, and only then deleted (so as not to create rubbish).

What ideas do I have so far. Initially, I came up with giving users a boolean variable with a value of false. When they click on the start chat button, it gets the value true. In this way, I find out which users want to chat. Then I get the UID of this user and add it to the array of everyone who wants to get into the chat. And here's what to do next. I can’t understand how, for example, from this array to tell two random users to go to a room, which in turn must somehow be created
... or maybe there is some kind of article in general where they write in java exactly this kind of chat and not where 15 users sit. Tell me at least something)) I really want to solve this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drno, 2020-12-12
@Drno

Most likely, this can be done with requests to the Firebase API...
And specify the required number of people in the configs...
About saving - a script for copying and transferring. Through the same API

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question