是否有计划制定在 Web 应用程序中连接两个客户端 (P2P) 的标准?

发布于 2024-10-18 20:41:31 字数 803 浏览 6 评论 0原文

这个问题已经得到解答: Websockets 是否允许 p2p(浏览器到浏览器)通信?

答案是否定的。

我的问题是:这方面有什么计划吗? W3C 或其他组织是否有任何推测性草案来规划此功能? (我用谷歌搜索并没有找到任何东西,但我不确定我是否在搜索错误的东西。)

WebSockets API,例如,它允许您非常有效地将文件从一个用户传输到另一个用户(例如 http://jetbytes.com/ 以及我见过的其他一些)。我相信这些工作是通过服务器传输文件来实现的 - 它在服务器上非常轻,因为它不必在发送到接收客户端后存储每个块。但每次文件传输它都会使用服务器的带宽两次(向下和向上)。

如果服务器可以将每个客户端的 IP 地址(和端口?)传递给另一个客户端,并且整个数据传输可以在它们之间进行,那么(对于服务器和两个客户端)将会更有效。

为了安全起见,浏览器可以提示每个用户授予权限(“该网站,example.com,想要将您连接到 IP 地址 1.2.3.4 以接收 23MB 的文件传输。允许/拒绝?”)。

如果没有计划发布这方面的规范,为什么不呢?

This question has been answered:
Do websockets allow for p2p (browser to browser) communication?

The answer is no.

My question is: are there any plans for this? Any speculative draft by the W3C or whoever, planning this capability? (I have googled and found nothing, but I'm not sure if I'm searching the wrong thing.)

There is the WebSockets API, which allows you to, for example, transfer files from one user to another quite efficiently (like http://jetbytes.com/ and some others I've seen). I believe these work by piping the file through the server - it's very light on the server, as it doesn't have to store each chunk after its sent to the receiving client. But it does use the server's bandwidth twice (down and up) for each file transfer.

It would be more efficient (for server and both clients) if the server could just pass the IP address (and a port?) of each client to the other, and the entire data transfer could take place between them.

For security, the browser could prompt each user to give permission ("This website, example.com, wants to connect you to IP address 1.2.3.4 to receive a file transfer of 23MB. Allow/Refuse?").

If there are no plans to publish a spec on this, why not?

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

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

发布评论

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

评论(2

慕烟庭风 2024-10-25 20:41:31

Web 应用程序中的 P2P 数据交换有一个拟议标准:WebRTC 数据通道 API

JavaScript 实现示例包括 PeerJSBoneValueWebRTC.io

There is a proposed standard for P2P data exchange in web apps: WebRTC Data Channel API.

Example JavaScript implementations include PeerJS, BoneValue and WebRTC.io.

晒暮凉 2024-10-25 20:41:31

一些 RFC 已经被实现来解决部分问题(即 NAT 穿越),但整个问题相当复杂,我怀疑它们是否会成为完整的官方标准化。

您所建议的实际上是 P2P 框架的 TURN 和 STUN 实现。它“看起来”很简单,但当你了解细节时,你会发现这是一个复杂的技术问题(我什至没有提到安全性)。这不仅仅是传递 IP 地址的问题。

如果您想了解更多详细信息,请阅读 Practical JXTA II 书中的 NAT 遍历章节,该书可在 Scribd 上在线阅读。

Some RFC's have been implemented to solve parts of the problem (i.e., NAT traversal), but whole problem is pretty complex and I doubt their will ever be a complete official standardization.

What you are suggesting is in fact TURN and STUN implementations of P2P frameworks. It 'looks' easy, but when you get in the details, it is a complex technical issue (and I am not even mentioning security). It is not just a matter of passing IP addresses.

If you want more details, read the NAT traversal chapter from the Practical JXTA II book available online for reading at Scribd.

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