简体   繁体   English

Websockets 会允许服务器在浏览器中运行吗?

[英]Will Websockets allow a server to run in the browser?

Are there any plans for a Websockets listen function?是否有 Websockets 侦听功能的计划?

Allowing peer to peer applications in the browser could be revolutionary.在浏览器中允许点对点应用程序可能是革命性的。

I found this answer: Will HTML5 allow web apps to make peer-to-peer HTTP connections?我找到了这个答案: 将 HTML5 允许网络应用程序建立点对点 HTTP 连接吗? but it is rather old.但它相当古老。 I think the specification it refers to (the Connection api) has now been replaced with Websockets, which does not mention any listen facility.我认为它所指的规范(Connection api)现在已经被 Websockets 所取代,它没有提到任何监听设施。

The WebSockets API does not provide a way to listen for connections; WebSockets API不提供侦听连接的方法; it is client only.它只是客户端。

You might be interested in Opera Unite .您可能对Opera Unite感兴趣。

Update:更新:

Also check out pusherapp .另请查看pusherapp It's a WebSockets service online.这是一个在线的 WebSockets 服务。 They charge for over 5 clients, but it's super simple to setup and use.他们对超过 5 个客户收费,但设置和使用非常简单。 Depending on what your p2p application requirements are, it might suffice.根据您的 p2p 应用程序要求,它可能就足够了。

Old question, but I was wondering the same thing, and came across peer-server, which might be worth having a look at.老问题,但我想知道同样的事情,并遇到了对等服务器,这可能值得一看。 It uses WebRTC, and looks like it does what you're thinking:它使用 WebRTC,看起来就像你在想的那样:

https://github.com/PeerServer/peer-server https://github.com/PeerServer/peer-server

Tangentially related to your question, but you did say "p2p in the browser", so..与您的问题相关,但您确实说“浏览器中的 p2p”,所以..

The Flash player has p2p APIs that allow direct connection with other peers (typically other browsers) over UDP. Flash 播放器具有p2p API ,允许通过 UDP 与其他对等点(通常是其他浏览器)直接连接。

The APIs are geared toward using those connections for voice/video streaming, but it seems possible to use them for generic message passing as well. API 旨在将这些连接用于语音/视频流,但似乎也可以将它们用于通用消息传递。

The tricky point of course is "how do peers find each others?".当然,棘手的一点是“同行如何找到彼此?”。 Currently, Adobe offers a free/beta service to do that, called Cirrus (formerly Stratus) .目前,Adobe 提供了一项免费/测试版服务,称为Cirrus(以前称为 Stratus) It's also possible to buy Flash Media servers from Adobe to do the same (which also provide TCP server-based fallbacks for folks that are behind UDP-unfriendly firewalls.) Presumably, open-source alternatives like Red5 will have support for it too at some point.也可以从 Adob​​e 购买 Flash Media 服务器来做同样的事情(它也为 UDP 不友好防火墙后面的人提供基于 TCP 服务器的后备。)据推测,像Red5这样的开源替代品也会在某些时候支持它观点。

If you are not looking for a generic browser solution, for non secure and limited connections you may use a Google Chrome extension to do the job:如果您不是在寻找通用浏览器解决方案,对于非安全和有限的连接,您可以使用 Google Chrome 扩展程序来完成这项工作:

Web Server for Chrome Chrome 网络服务器

https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM