firebase自动监听更改

2024-10-02 18:19:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我的firebase数据库中有大约10个用户,我想观察是否发生了一些变化。早些时候,我观察了完整的数据库,当5个用户同时在他的手机上单击submit时,数据被混合了,这就是它们存储在数据库中的方式。之后,我为每个用户编写了单独的侦听器和单独的函数,这就是侦听的过程:

def aer(post):
        handle_fiba_post(post, "go")


def ber(post):
        handle_fiba_post(post, "zi97")


def cer(post):
        handle_fiba_post(post, "ja7")

go_fa = db.child("cs").child("go").stream(aer)
zi97_fa = db.child("cs").child("zi97").stream(ber)
ja7_fa = db.child("cs").child("ja7").stream(cer)

有没有什么方法可以让我分别处理每个用户,并倾听他们的声音,而不会得到错误用户的错误数据?你知道吗

谢谢


Tags: 数据用户数据库childgodbstreamdef