开发者

Will Websockets allow a server to run in the browser?

Are there any plans for a Webs开发者_开发百科ockets listen function?

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? 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.


The WebSockets API does not provide a way to listen for connections; it is client only.

You might be interested in Opera Unite.

Update:

Also check out pusherapp. It's a WebSockets service online. They charge for over 5 clients, but it's super simple to setup and use. Depending on what your p2p application requirements are, it might suffice.


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:

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


Tangentially related to your question, but you did say "p2p in the browser", so..

The Flash player has p2p APIs that allow direct connection with other peers (typically other browsers) over 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.

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). 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.


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:

Web Server for Chrome

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜