How can you keep your database secure implementing this on frontend? I mean, you need to implement some busines rules sayng which node each client connected can change, and how it can be changed right?
Let's say that it is not a chat, but a more complicated system, how can we deploy something like this with a realtime communication between clients using Firebase?