Best way to manage Chat channels in Firebase

后端 未结 4 1870
时光取名叫无心
时光取名叫无心 2020-11-22 01:25

In my main page I have a list of users and i\'d like to choose and open a channel to chat with one of them.

I am thinking if use the id is the best way and control a

4条回答
  •  一向
    一向 (楼主)
    2020-11-22 02:05

    In a typical database schema each Channel / ChatGroup has its own node with unique $key (created by Firebase). It shouldn't matter which user opened the channel first but once the node (& corresponding $key) is created, you can just use that as channel id.

    Hashing / MD5 strategy of course is other way to do it but then you also have to store that "route" info as well as $key on the same node - which is duplication IMO (unless Im missing something).

提交回复
热议问题