Sinatra 服务器推送?

发布于 2024-07-26 21:57:24 字数 125 浏览 0 评论 0原文

将数据从用 Sinatra 编写的服务器推送到客户端的最佳方法是什么? 与聊天室类似,但没有 Ajax 每 2500 毫秒轮询一次。

我知道 Rails 中的 Juggernaut,但对 Sinatra 很好奇。

What is the best way to push data from a server written in Sinatra to a client? Think similarly to a chat room, but without Ajax polling every 2500ms.

I know of Juggernaut in Rails, but was curious about Sinatra.

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

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

发布评论

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

评论(1

稚然 2024-08-02 21:57:24

谷歌搜索了一下,发现了 Marc-André 的这篇博文Cournoyer,它讨论了 Thin Web 服务器的异步响应功能,并包含一个指向 async-sinatra 库的链接来执行此操作。 您还可以查看 orbited-ruby,它是 < a href="http://orbited.org/" rel="noreferrer">轨道彗星服务器。 这两者似乎都是相当新的且未经测试的,因此您可能需要自己进行一些修改才能使您的应用程序正常工作。

A little googling turned up this blog post by Marc-André Cournoyer, which discusses the asynchronous response feature of the Thin web server and includes a link to an async-sinatra library to do just this. You could also take a look at orbited-ruby, a Ruby implementation of the Orbited Comet server. Both of these appear to be pretty new and untested, so you might have to do a little hacking yourselves to get things working correctly for your application.

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