数据库发生变化时前端实时更新 [英] Real time updation in front end when changes occur in database

查看:49
本文介绍了数据库发生变化时前端实时更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在数据库记录更新或更改时更新前端 ui

How to update front end ui when database records updates or changes

示例推特Twitter帖子动态增加没有喜欢

Example Twitter Twitter post dynamically gets increased no of likes

我们将使用什么技术来进行这种实时更新以及方式是什么

What is the technology we shall use for this kind of real time updates and what is the way

另一个例子 firebase当 Firebase 记录中的某些内容更新时自动前端ui更新

Another example firebase When something updates in firebase records Automatically front end ui updates

请有人帮我破解这个

推荐答案

将数据从服务器推送到(Web)客户端的解决方案有很多.Firebase 中的一些示例:

There are many solutions for pushing data from a server to a (web) client. Some examples from Firebase:

  • Firebase 的实时数据库 SDK 使用 Web 套接字来维护客户端和服务器之间的连接.
  • 当您使用 Firebase 实时数据库的 REST API 访问时,您可以使用服务器发送事件 (SSE) 来完成流式更新.
  • Cloud Firestore 通过 HTTP/2 使用长轮询请求.这种类型的连接有很多解决方案.

更多阅读:

  • Is there some way to PUSH data from web server to browser?
  • How can a server send an update without a client request?
  • HTML push data from server to client updates without polling (no answer, but the question contains some relevant links)
  • How to push live data from nodejs server to AngularJS?
  • and probably more from these search results

这篇关于数据库发生变化时前端实时更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆