You did a great job of summarizing what's awesome about Node.js.
(在总结Node.js的出色功能方面,您做了出色的工作。)
My feeling is that Node.js is especially suited for applications where you'd like to maintain a persistent connection from the browser back to the server. (我的感觉是,Node.js特别适用于您想要维持从浏览器到服务器的持久连接的应用程序。)
Using a technique known as "long-polling" , you can write an application that sends updates to the user in real time. (使用一种称为“长轮询”的技术 ,您可以编写一个向用户实时发送更新的应用程序。)
Doing long polling on many of the web's giants, like Ruby on Rails or Django , would create immense load on the server, because each active client eats up one server process. (在Ruby on Rails或Django之类的许多Web巨人上进行长时间的轮询会在服务器上产生巨大的负载,因为每个活动的客户端都要吃掉一个服务器进程。)
This situation amounts to a tarpit attack. (这种情况相当于一次沥青袭击。)
When you use something like Node.js, the server has no need of maintaining separate threads for each open connection. (使用Node.js之类的服务器时,服务器无需为每个打开的连接维护单独的线程。)
This means you can create a browser-based chat application in Node.js that takes almost no system resources to serve a great many clients.
(这意味着您可以在Node.js中创建一个基于浏览器的聊天应用程序 ,该应用程序几乎不需要占用系统资源即可为大量客户端提供服务。)
Any time you want to do this sort of long-polling, Node.js is a great option. (每当您想进行这种长轮询时,Node.js都是一个不错的选择。)
It's worth mentioning that Ruby and Python both have tools to do this sort of thing ( eventmachine and twisted , respectively), but that Node.js does it exceptionally well, and from the ground up.
(值得一提的是,Ruby和Python都具有执行此类操作的工具(分别是eventmachine和twisted ),但是Node.js从头开始就表现出色。)
JavaScript is exceptionally well situated to a callback-based concurrency model, and it excels here. (JavaScript在基于回调的并发模型中处于特殊位置,并且在这里很有用。)
Also, being able to serialize and deserialize with JSON native to both the client and the server is pretty nifty. (而且,能够使用客户端和服务器都原生的JSON进行序列化和反序列化非常漂亮。)
I look forward to reading other answers here, this is a fantastic question.
(我期待在这里阅读其他答案,这是一个很棒的问题。)
It's worth pointing out that Node.js is also great for situations in which you'll be reusing a lot of code across the client/server gap.
(值得指出的是,Node.js对于在客户端/服务器之间重复使用大量代码的情况也非常有用。)
The Meteor framework makes this really easy, and a lot of folks are suggesting this might be the future of web development. (Meteor框架使这变得非常容易,并且很多人都认为这可能是Web开发的未来。)
I can say from experience that it's a whole lot of fun to write code in Meteor, and a big part of this is spending less time thinking about how you're going to restructure your data, so the code that runs in the browser can easily manipulate it and pass it back. (我可以从经验中说,用Meteor编写代码非常有趣,其中很大一部分是花更少的时间思考如何重组数据,因此可以轻松地在浏览器中运行代码操纵它,并将其传递回去。)
Here's an article on Pyramid and long-polling, which turns out to be very easy to set up with a little help from gevent: TicTacToe and Long Polling with Pyramid .
(这是一篇有关金字塔和长轮询的文章,事实证明,在gevent的一点帮助下,设置起来非常容易: TicTacToe和金字塔长轮询 。)