从网络/TCP/HTTP 连接的角度来看,Node.js 是如何工作的? WCF可以模拟这个吗?
我的理解是,node.js 是一个面向 Linux 世界的 Python 应用程序。每个人似乎都对它的速度和处理许多并发连接的能力感到非常满意。
我有 Microsoft 背景,认为 Node.js 可以使用 WCF 来实现。
有人可以告诉我 Node.js 如何在网络背景下运行,并可选择提供是否可以将其移植到 WCF 或 Azure 服务总线的见解吗?
My understanding is that node.js is a python app that is geared towards the Linux world. Everyone seems to be quite happy with it's speed and ability to handle many concurrent connections.
I'm coming from a Microsoft background and think node.js might be able to be implemented using WCF.
Can someone tell me how node.js operates from a network background, and optionally provide insight if this can be ported to WCF or the Azure Service Bus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Node 是一个 Javascript 框架,
青睐需要使用事件驱动的方法来编写网络服务。 Node 不会阻塞网络操作(通常是网络编程的方式),而是为您提供事件处理程序,这些事件处理程序会在发生有趣的事情(客户端连接、字节到达、DNS 查询返回等)时触发。因此,Node 非常适合 实时网络应用。由于 Node 是一个 Javascript 框架,现在可以使用 Node 的许多有趣的库。其中一些在非常可爱的API背后隐藏着令人难以置信的力量。
有Windows 版 Node 的二进制版本,但它们尚未被视为稳定。 Node 的级别比 WCF/Azure 低得多——它是套接字、DNS、HTTP 等的事件驱动包装器。如果你愿意的话。除了事件驱动之外,它不强制要求如何实现网络服务(例如合同或数据编组)。我相信在这些技术之上实现节点克隆会损害低延迟(至少),但也许更有资格的人可以告诉我们是否可以做到。
附言。 Node 网站很好地解释了它的工作原理。
聚苯硫醚。可能相关的是 Rx for .NET。
Node is a Javascript framework that
favorsrequires an event-driven approach to writing network services. Instead of blocking on networking operations, which is how network programming is usually done, Node gives you event handlers that are triggered when interesting stuff happens (clients connect, bytes arrive, DNS queries return, &c.).As a consequence, Node is well-suited to and is being widely explored for realtime web apps. A host of interesting libraries for Node are now available, thanks to it being a Javascript framework. Some of them hide incredible power behind a very cute API.
There are binary versions of Node for Windows, but they are not deemed stable yet. Node is much lower level than WCF/Azure -- it's an event driven wrapper for sockets, DNS, HTTP, &c. if you will. It does not enforce any requirements as to how a networked service should be implemented (such as contracts or data marshalling) other than being event driven. I believe implementing a Node clone on top of those technologies would harm low-latency (at least), but perhaps someone more qualified can tell if it can be done.
PS. The Node website does a good job of explaining how it all works.
PPS. Possibly related, although I didn't have the time to read a lot about it, is Rx for .NET.
Node.js 是一个(非常好的)编程模型,它利用 Javascript 非常适合异步编程的特性来实现异步 Web 应用程序。其原理与 Windows 上的异步编程模型非常相似,尤其是在 .NET 中(WCF 很好地支持了这一点),其中所有工作都是在 I/O 线程调用的回调上完成的,并且应用程序从不锁定线程。 Node.js 围绕这个基础机制创建了严格的 JS 编程模型,以允许更好地扩展应用程序。因此,与这里一些人所说的相反,Node.js 与 WCF 完全处于同一层/级别。从协议的角度来看,Node.js 实现可能始终位于应用程序和底层 HTTP 基础设施提供的 HTTP 侦听器之间。
Node.js is a (really nice) programming model that's leveraging the great suitability of Javascript for asynchronous programming for implementing asynchronous web apps. The principle is very similar to the asynchronous programming model on Windows and especially in .NET (WCF supports this quite well) where all work is done on callbacks invoked by I/O threads and the app never locks a thread. Node.js creates a stringent JS programming model around this foundational mechanism to allow better scaling apps. So contrary to what a few folks here are saying, Node.js is quite exactly at the same layer/level as WCF. From a protocol perspective a Node.js implementation will likely always sit between the app and the HTTP listener provided by the underlying HTTP infra.