EventMachine与Node.js [英] EventMachine vs Node.js

查看:90
本文介绍了EventMachine与Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将开发一个协作站点,其中一项功能将是通过实时更改进行协作编辑.也就是说,当两个或多个用户正在编辑同一个文档时,他们可以在更改发生后立即看到彼此的更改. 我在Ruby on Rails上有一些经验,所以我一直在考虑使用EventMachine,但是由于对Node.js的所有宣传,我知道可以考虑使用它.那么,使用Node.js代替EventMachine的主要好处是什么?

I'm going to develop a collaborative site, and one of the features will be collaborative editing with realtime changes. i.e. when two or more users are editing the same doc, they can see each other changes as soon as they happen. I have some experience with Ruby on Rails, so I was thinking about using EventMachine, but with all this hype around Node.js, I am know considering using it instead. So, what would be the main benefits of using Node.js instead of EventMachine?

tl;博士 除了语言之外,EventMachine和Node.js之间的主要区别是什么?

tl;dr What are the main differences between EventMachine and Node.js (besides the language)?

推荐答案

EventMachine与Rails无关,只是它们都是用相同的语言编写的.您可以像Node.js一样获得EventMachine;您要做的就是不向您的项目添加库.以我的经验,EventMachine库(例如em-http)比Node更好.而且,您可以使用光纤而不是回调来避免回调地狱.由于所有回调,在Node中几乎不可能完成完整的异常处理.另外,Ruby是比Java语言更好,更完整的语言.

EventMachine has nothing to do with Rails apart from them both being written in the same language. You can get EventMachine as bare as Node.js; all you have to do is not add libraries to your project. In my experience the EventMachine libraries (like em-http) are much nicer than anything for Node. And you can use fibers instead of callbacks to avoid callback hell. Complete exception handling is pretty much impossible in Node because of all the callbacks. Plus Ruby is a nicer, more complete language than Javascript.

这篇关于EventMachine与Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆