[英]Is there way to disable realtime update with Firebase?
I'm using Firebase in my frontend project.我在我的前端项目中使用 Firebase。 More specific I use methods set() and once("value") to change and get data from realtime database table.更具体地说,我使用方法 set() 和 once("value") 来更改实时数据库表并从中获取数据。 Now I see in the.network tab of browser Firebase uses websocket connection to the server.现在我在浏览器的 .network 选项卡中看到 Firebase 使用 websocket 连接到服务器。 But I don't need any realtime updates.但我不需要任何实时更新。 Is there way to disable it?有没有办法禁用它?
If you only use once()
listeners, you already won't receive realtime updates.如果您只使用once()
侦听器,您将不会收到实时更新。 But Firebase will still use web sockets to communicate between client and server.但是 Firebase 仍然会使用 web sockets 在客户端和服务器之间进行通信。
If for some reason you don't want to use web sockets, the only way to do so is to call the REST API of Firebase yourself.如果出于某种原因您不想使用 web sockets,唯一的方法是自己拨打 Firebase 的 REST API。 But you'll lose all benefits of using the SDK, such as its ability to handle loss of connectivity, it retrying of transactions, and more.但是您将失去使用 SDK 的所有好处,例如处理连接丢失的能力、重试交易等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.