How can I send message to particular subscriber in a bradcast list using firebase?

100 Views Asked by At

I am thinking to implement in-app chat feature in my android app.

What I want is the user responsible for creation of the broadcast group may able to broadcast message to every subscriber. Also he should be able to send message to a specific subscriber of a group but using the same group chat window without having to implement different channel for the specific subscriber.

Can anyone give me an idea how can I implement this using firebase?

Below are the steps I can think on how it may be possible:

  1. Whenever person types "@" he can select subscriber to send msg exclusively.
  2. Then by some means for eg token/uid the msg is send to that particular subscriber.
  3. If "@" symbol is not used message is sent to all subscribers.

Is there a better predefined way to perform this?

1

There are 1 best solutions below

0
On

There are 2 ways that i can think of doing this:

  • start a new point-to-point connection with the targeted person and send your message directly to them

  • perform a multi-cast to everyone in the chat, and send the targeted user ID with the message, then in the receiving side, if that ID is not yours, discard the message.