[英]Sending the content of a file from the server to the browser conditionally
What is the mechanism to send the content of a file from a server to the browser only if the file is updated? 仅在文件更新时才将文件内容从服务器发送到浏览器的机制是什么?
For example, I have a file abc.bin
on the server which will be updated regularly. 例如,我在服务器上有一个文件
abc.bin
,它将定期更新。 Every time the file is updated/modified, the server must send the content to the browser. 每次更新/修改文件时,服务器都必须将内容发送到浏览器。 What method exists to do this?
有什么方法可以做到这一点?
Your option is either to write a script which polls for the latest version number and compares it with the latest version number on the client side. 您的选择是编写一个脚本以轮询最新版本号,并将其与客户端上的最新版本号进行比较。 If found it downloads the file via a hidden iframe or something like that.
如果找到,它将通过隐藏的iframe或类似的文件下载文件。
Or you use some web socket based solution. 或者您使用一些基于Web套接字的解决方案。 Eg Pusher offers a service for something like that.
例如, Pusher为此类服务提供服务。
In mobile apps that design is called push notifications. 在移动应用程序中,这种设计称为推送通知。 -> use the terminology to find further information.
->使用术语查找更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.