简体   繁体   English

如何使用Firebase将消息发送到广播列表中的特定订户?

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

I am thinking to implement in-app chat feature in my android app. 我正在考虑在我的android应用中实现应用内聊天功能。

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? 谁能给我一个主意,如何使用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. 然后通过某种方式(例如令牌/ uid)将消息发送到该特定订户。
  3. If "@" symbol is not used message is sent to all subscribers. 如果未使用“ @”符号,则将消息发送给所有订户。

Is there a better predefined way to perform this? 有没有更好的预定义方法来执行此操作?

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. 在聊天中向所有人进行多播,然后将目标用户ID与消息一起发送,然后在接收方,如果该ID不是您的ID,则丢弃消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM