Node.js 可以通过其本机客户端在 Chrome 中运行客户端吗(即将发布)

发布于 2024-10-19 02:07:26 字数 267 浏览 6 评论 0原文

Google Chrome 的原生客户端即将发布。 http://blog.chromium.org/2011 /02/native-client-getting-ready-for-takeoff.html 这是否允许 Node.js 在浏览器中运行,从而使分布式应用程序无需通过服务器即可相互通信?

Google Chrome's native client is soon to be released. http://blog.chromium.org/2011/02/native-client-getting-ready-for-takeoff.html
Would this allow node.js to be run within the browser enabling distributed applications to communicate with each other without having to go through the server?

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

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

发布评论

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

评论(4

謌踐踏愛綪 2024-10-26 02:07:26

现在有几种解决方案允许您在 chrome 中运行一些 Node 模块。查看这些链接:

Nowadays there are several solutions that allow you to run some Node modules in chrome. Have a look on these links:

泅渡 2024-10-26 02:07:26

截至今天,Node.js 将无法在 NaCl 中运行,但最终可能会实现。 Node 使用 V8 JavaScript 引擎来执行代码。目前还没有可靠的 V8 发动机端口可以在 NaCl 内运行。

来自 Brad Chen 在 2014 年 1 月 28 日的评论,在主题“有人尝试过将 Blink 和 V8 移植到 Native Client 吗?”中:

V8 已移植到 Native Client,尽管该移植使用了
让 V8 生成 ARM 指令然后使用
便携式 ARM 解释器,无需移植 V8 代码生成器
至氯化钠。您应该能够通过检查 V8 源代码来观察这一点
并使用目标遵循标准构建/测试说明
nacl_ia32 或 nacl_x64。

https://groups.google.com/d/msg/native -client-discuss/Xw5yCe3Ubwc/fgm6M092DXwJ

考虑到 V8 已经能够在 NaCl 下运行,尽管存在不可靠的 hack,所以可以合理地假设 Node 最终可能能够在 NaCl 中运行。我意识到你的问题已经存在三年了,但我想我应该提供一个更新的答案,因为在浏览器中运行本机代码(甚至 OpenGL 代码)现在已经成为现实。

As of today, Node.js will not run in NaCl, however it may be possible eventually. Node uses the V8 JavaScript engine to execute code. Currently there is no reliable port of the V8 engine that will run within NaCl.

From a comment by Brad Chen on Jan 28, 2014, in the thread "Has anyone tried porting Blink and V8 to Native Client?":

V8 has been ported to Native Client, although the port used an
unsavory trick of having V8 generate ARM instructions and then use a
portable ARM interpreter to avoid the need to port V8 code generators
to NaCl. You should be able to observe this by checking out V8 source
and following the standard build/test instructions using targets
nacl_ia32 or nacl_x64.

https://groups.google.com/d/msg/native-client-discuss/Xw5yCe3Ubwc/fgm6M092DXwJ

Considering that V8 has already been able to run under NaCl, albeit with an unreliable hack, it's reasonable to assume that Node might eventually be able to run in NaCl. I realize your question is now three years old but figured I'd provide an updated answer since running native code (even OpenGL code) in the browser is now a reality.

过度放纵 2024-10-26 02:07:26

node.js 不是纯 Javascript 代码。它的部分内容是用 C++ 编写的,因此这种情况不太可能发生。

分布式通信有多种可能性。一种是使用浏览器中的Websockets api与其他浏览器进行通信。另一种是在与浏览器相同的计算机上将 node.js 作为单独的服务器进程运行。

第二种是构建分布式应用程序的更好选择,因为它减少了对浏览器的依赖。 Node.js 的 0.5.0pre 版本现在可以在 Cygwin 上构建,并且可以将 Cygwin 的基本组件捆绑为独立的二进制文件以分发到 Windows 客户端。 旧版本的node.js曾经以这种方式分发。

node.js is not pure Javascript code. There are parts of it written in C++ so this is unlikely.

There are a couple of possibilities for distributed communication. One is to use the Websockets api in the browser to communicate with other browsers. The other one is to run node.js as a separate server process on the same machine as the browser.

This second is a better choice for building a distributed application because it reduces dependence on the browser. Version 0.5.0pre of node.js now builds OK on Cygwin and it is possible to bundle up the essential components of Cygwin as a standalone binary to distribute to Windows clients. Older versions of node.js used to be distributed this way.

寄居人 2024-10-26 02:07:26

您无法在浏览器中运行 Node.js。

但是,如果您想进行P2P连接,则浏览器安装了最新版本的Flash(Flash 10)是可以的。在最新版本中,他们引入了 RTMFP,它可以让您无需通过服务器即可进行 P2P 连接。如果你想在Javascript中使用它,你可以做一个桥,或者你可以看看一个项目我最近开始正是这样做的。

You can't run Node.js in a browser.

However, if you want to do P2P connection, it's possible if the browser has the latest version of Flash (Flash 10) installed. In the latest version, they introduced RTMFP which let's you do P2P connection without passing through a server. If you want to use it in Javascript, you can make a bridge or you can take a look at a project I started recently that does exactly that.

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