Rails 聊天服务器

发布于 2024-10-07 16:22:45 字数 127 浏览 0 评论 0原文

很明显,基于 AJAX 的聊天无法扩展,那么您会使用什么来进行聊天呢?定制服务器?或者还有其他方法吗?

由于使用 Rails,每个聊天连接都会占用大量内存,因此为每条消息运行 Rails 都是不可行的。您建议在这里使用什么?

As it is evident that AJAX based chats do not scale, so what would you use for chats? Custom servers? Or any other methods?

Since with Rails each chat connection will take lots of memory, it won't be feasible to even have Rails run for each message. What do you recommend for use here?

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

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

发布评论

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

评论(5

木落 2024-10-14 16:22:45

我还尝试使用 AJAX 实现示例聊天应用程序(在内置 Ajax.updater 中),但它没有成功。我确信可能有一些好的ajax 解决方案。

但由于这是基于服务器推送技术,请尝试 Juggernaut (http://juggernaut.rubyforge.org/ )。我个人没有尝试过,但看起来还是不错的。

或者如果可能的话考虑网络套接字(HTML5)。

I also tried to implement a sample chat app with AJAX (in built Ajax.updater) but it didn't workout. I'm sure there might be some good ajax solution.

But since this is based on server push technology, try Juggernaut (http://juggernaut.rubyforge.org/). I personally haven't tried, but it seems like it's good.

Or else consider web sockets (in HTML5) if possible.

温柔女人霸气范 2024-10-14 16:22:45

人们经常使用 Evented Ruby 来处理这样的问题 https://github.com/eventmachine/eventmachine 之一我在 2010 年 Railsconf 上参加的一次演讲中的示例。

例如 http://playtype. net/past/2009/3/11/mini_an_eventmachine_clone_of/ 是 irc 机器人的事件 Ruby 实现

People often use Evented Ruby for handling problems like this https://github.com/eventmachine/eventmachine one of the examples in a talk I went to at railsconf 2010.

For example http://playtype.net/past/2009/3/11/mini_an_eventmachine_clone_of/ is a evented ruby implementation of an irc bot

她比我温柔 2024-10-14 16:22:45

不幸的是,您的帖子是基于错误的前提。基于 AJAX 的聊天当然可以扩展,您只需以正确的方式进行即可。例如,Juggernaut 2 使用 Node.js 来处理许多并发连接。你是对的,你无法在一台服务器上处理 10,000 个连接。这就是负载平衡的用途。

Unfortunately your post is based on a false premise. AJAX based chat certainly can scale, you just have to do it the right way. Juggernaut 2, for example, uses Node.js to handle many concurrent connections. You're right, you won't be able to handle 10,000 connections on a single server. That's what load balancing is for.

放飞的风筝 2024-10-14 16:22:45

您是否有一些基于定量测试的数据(除了您自己的定性结论)?

Do you have some data based on quantitative testing (aside from your own qualitative conclusions)?

清眉祭 2024-10-14 16:22:45

为什么要创建任何类型的自定义聊天服务器? IRC 已经存在很长一段时间了,并且经过了尝试和测试。

在我看来,这里真正的问题应该是关于客户端实现,而不是试图重新发明轮子服务器端。

Why create any kind of custom server for chat? IRC has been around for quite a while and is tried and tested.

The real question here should be about client-side implementations rather than trying to reinvent the wheel server side imo.

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