简体   繁体   English

处理Angular中服务器路由/控制器的更新

[英]Handling updates from a server route/controller in Angular

Hi guys i have some experience with using Angular 大家好我有一些使用Angular的经验

Basically i need to know whether i can push updates to Angular controller from the backend and how theoretically it can be done? 基本上我需要知道我是否可以从后端推送Angular控制器的更新以及理论上它是如何完成的?

In the traditional REST sense i'm pulling 100 records via a get request from angular controller but how about if i wanted to call get once, then as the data is updated every second or two on the server it pushes to Angular 在传统的REST意义上,我通过角度控制器的get请求来提取100条记录但是如果我想调用get一次,那么当数据在服务器上每隔一两或两次更新时就会推送到Angular

我认为您最好的机会是实施轮询机制来检查更新或查看SignalR

You're looking for websockets. 你正在寻找websockets。 Depending on your server you will need a specific module or configuration. 根据您的服务器,您将需要特定的模块或配置。

For nodeJS we use socket.io 对于nodeJS,我们使用socket.io

For tomcat you can take a look at https://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html 对于tomcat,您可以查看https://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html

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

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