RFC/长时间运行命令的网络轮询标准
我们有一个旧的 Web UI,其中一部分通过 AJAX 轮询设备以获取长时间运行的命令的结果,因此可以向用户显示命令的进度和 stdout/stderr。它只是每隔几秒发出一次请求以获取可用的新输出;这里没有火箭科学。
几年后的现在,我们正在重构其所有 Web UI。这让我想知道,“肯定其他人一直在做这种事情 - 必须有一个 RFC”。我四处挖掘,但空手而归。
是否已经有一个标准来描述进行这种短轮询的流行方式? (以及这些标准是什么?)
它将独立于实现,只是将协议描述为 HTTP 的子集。例如,请求是通过 GET 或 POST 或 PUT 完成的;哪些 HTTP 状态代码用于指示作业状态(已排队、正在运行、已中止、已完成等),或者是通过响应标头完成的,以及为这些标头指定的名称;或者我们是否在查询参数或标头或正文内容中发送客户端信息,...?
有很多不同的方法可以做到这一点,我认为用通用的方法来做到这一点会很好。
We've got an old web UI wherein part of it polls an appliance via AJAX to get the results of long-running commands, so the progress and stdout/stderr of the commands can be displayed to the user. It just does a request every few seconds to get whatever new output is available; no rocket science here.
Now, years later, we're refactoring all its web UIs. That got me wondering, "surely others do this kind of thing all the time - there's got to be an RFC for it". I went digging around but came up empty handed.
Is there already a standard that describes a popular manner for doing this short-polling? (and what is/are these standards?)
It would be implementation independent, just describing the protocol, as a subset of HTTP. For example, are requests done with GET or POST or PUT; what HTTP status codes are used to indicate job status (queued, running, aborted, done, etc), or is this done with response headers, and what name was given to these headers; or do we send client info in query params or headers or body content, ...?
There's so many different ways this can be done, I thought it would be nice to do it the common way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AJAX 是由一组基于标准的技术完成的。似乎术语 AJAX(针对现有的 Web 应用程序模型)是由 Adaptive Path 创造的,作为异步 JavaScript + XML 的简写。
请参阅:Ajax:Web 应用程序的新方法
AJAX is done by a set of standards-based technologies. Seems the term AJAX, for an existing web application model, was coined by Adaptive Path as a shorthand for Asynchronous JavaScript + XML.
see: Ajax: A New Approach to Web Applications