是否有计划制定在 Web 应用程序中连接两个客户端 (P2P) 的标准?
这个问题已经得到解答: 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Web 应用程序中的 P2P 数据交换有一个拟议标准:WebRTC 数据通道 API。
JavaScript 实现示例包括 PeerJS、BoneValue 和 WebRTC.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.
一些 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.