简体   繁体   English

Firebase 架构

[英]Firebase architecture

I currently have a server running in Django and a frontend in Angular 2. I'm planning to build a chat messaging using Firebase but I don't know if I should call the saving of data directly in client or send it first in my server and do the calls there.我目前有一个在 Django 中运行的服务器和一个在 Angular 2 中运行的前端。我计划使用 Firebase 构建一个聊天消息,但我不知道我是应该直接在客户端调用数据保存还是先在我的服务器中发送它并在那里打电话。

1) Client sends a message -> Firebase If I structure it like this, any users can have a read and write access on the database 1) 客户端发送消息 -> Firebase 如果我这样构造它,任何用户都可以对数据库进行读写访问

2) Client sends a message -> My Server (Using a service account) -> Firebase And if I structure it like this, clients will only have a read access so they can only subscribe but not send any message. 2) 客户端发送消息 -> 我的服务器(使用服务帐户)-> Firebase 如果我这样构造它,客户端将只有读取权限,因此他们只能订阅但不能发送任何消息。

What's the ideal way of doing it?做这件事的理想方式是什么?

Thank you谢谢

Firebase is meant for the Client sends a message -> Firebase Architecture. Firebase 用于客户端发送消息 -> Firebase 架构。

It is your responsibility to setup Rules correctly in Firebase so that read and write access on the database is based upon their Role/Authentication etc.您有责任在 Firebase 中正确设置规则,以便对数据库的读写访问基于其角色/身份验证等。

you may read more about configuring rules at Firebase : Security & Rules Quickstart您可以在Firebase阅读有关配置规则的更多信息:安全和规则快速入门

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

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