有什么办法可以通过浏览器使用 POST 请求吗?

发布于 2024-10-03 21:26:17 字数 285 浏览 1 评论 0原文

假设您有一个应用程序,可以在每次操作发生时发送 POST 请求。它允许快速、轻松地添加/删除订阅。

假设该网站是 Stackoverflow,它可以在每次提出新问题时向您发送 POST 通知。有什么方法可以在浏览器中使用这样的通知吗?

我想象一下当你花费>时的情况页面上 5 分钟后,如果自上次页面刷新以来该页面有更新,您将开始收到通知。我知道如何通过长轮询来做到这一点,但我想知道是否有任何方法可以从浏览器连接到这些服务器到客户端的 POST 请求(相对于重复的 GET 客户端到服务器的请求)并将数据推送到而是你。

Say you've got an app that can send out POST requests every time an action happens. It allows subscriptions to add/drop quickly and effortlessly.

Say that site is Stackoverflow and it can send a you POST notification every time a new question is asked. Would there be any way to consume notifications like this in browser?

I imagine a case when you spend > 5 min on a page you start to get notifications if it's updated since your last page refresh. I understand how you could do this via long polling but I am wondering if there's any way to hook into these server-to-client POST requests (vs. repeated GET client-to-server requests) from a browser and let data be pushed to you instead.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

秉烛思 2024-10-10 21:26:17

对于推送,您可以查看 HTML5 WebSocket API

For pushing you could take a look at HTML5 WebSocket API.

七禾 2024-10-10 21:26:17

客户端上的轻量级 Web 服务器(例如 Jetty)怎么样?

How about a lightweight web server on the client like Jetty?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文