Peer-to-peer file sharing with Web Sockets
To allow files to be shared without the need to upload it to the server, (i.e Coworkers) you can now use the WebRTC DataChannel API, to create a peer to peer connection.
Does HTML5 Support Peer-to-Peer (and not just WebSockets)
See the answers for Will HTML5 allow web apps to make peer-to-peer HTTP connections? However, the content in the WebSockets specification seems to have gone, so I suspect the answer now is "no".
Will HTML5 allow web apps to make peer-to-peer HTTP connections?
Instead of intelligent guesses, here is an informed answer:
HTML 5 plans to allow peer to peer connections from javascript, but these connections WILL NOT BE RAW TCP.
The complete spec can be found at http://dev.w3.org/html5/websockets/
jrh
EDIT: with specific reference to peer to peer connections, check out these links:
- Regarding peer to peer connections: http://www.w3.org/TR/2008/WD-html5-20080122/#peer-to-peer
- Regarding broadcast connections to the local network: http://www.w3.org/TR/2008/WD-html5-20080122/#broadcast
- Regarding TCP connections (in the encoded protocol): http://www.w3.org/TR/2008/WD-html5-20080122/#tcp-connections
- Complete proposed spec: http://www.w3.org/TR/2008/WD-html5-20080122/#network
Its important to note that the capabilities are still being negotiated. It will be nice to be able to create "local chat" web apps :)
jrh
Do websockets allow for p2p (browser to browser) communication?
No. Browsers can only initiate WebSockets connections, not receive them. The W3C browser API spec only defines how to start an outbound connection.
You can make an application that would both initiate and accept WebSockets connections, but browsers do not do this.
You might look at Pusher App which you could use to build a WebSockets application with multiple clients. The service provides up to 20 simultaneous WebSockets clients for free (you can pay for higher scaling).
Update:
The WebRTC protocol and API is making rapid progress and allows a Data Channel to be established between two peers (you still may need a STUN/TURN server for the initial NAT traversal and setup).
Peer to Peer web API on the same network
You can use the data-channel of WebRTC:
http://www.webrtc.org/
or you can set up a server and use WebSockets:
https://en.wikipedia.org/wiki/WebSocket
Drawbacks:
For WebRTC you will need a STUN server as I understood it, that will exchange the IP-addresses you use. For the rest the comminication is peer-to-peer.
It's currently scarce with examples on WebRTC as it is still in development. Only Chrome and Firefox (nightly) supports the protocol.
html5rocks has written a nice introduction on this (too much to paste in here):
http://www.html5rocks.com/en/tutorials/webrtc/basics/
For WebSockets you need a web server that function as a hub. This is however simple to set up as it uses the standard HTTP protocol. If you're on the .Net platform you can use for example SignalR which is easy to get up and running.
Note that for WebSocket it must initially be same-origin. This is however possible to circumvent (CORS). Typically the script using WebSockets is within the same web page and will communicate also with the same domain it was loaded from.
There are other options for WebSockets that use can use with node.js, socket.io, ruby and so forth.
UPDATE:
If you don't have a server peer-to-peer is gonna be difficult with plain html5. You will have to have something that negotiates the connections.
You can work around this by setting up a server locally on your computer and allow the other person to connect to that directly.
See for example this (free open-source TURN/STUN server):
http://code.google.com/p/rfc5766-turn-server/
Note: this server targets *NIX. I couldn't find a free solution for Windows if that's what you're using. There are commercial solutions as another option.
HTML5 peer to peer video?
if you are talking about webrtc the draft can be found here
w3c webrtc draft
Related Topics
Devise Logged in Root Route Rails 3
How to Find Out Which Gem Has a Specific Dependency
Understanding Ruby .Class and .Ancestors Methods
How to Compare Versions in Ruby
Using Factory_Girl in Rails with Associations That Have Unique Constraints. Getting Duplicate Errors
Rails Hidden Field Undefined Method 'Merge' Error
How to Get the Name of the Command Called for Usage Prompts in Ruby
Is "Extend Self" the Same as "Module_Function"
How to Do a Safe Join Pathname in Ruby
Bundler Cannot Install Any Gems Without Sudo
Open the Default Browser in Ruby
Error Installing Nokogiri on Bundle Install But Already Installed
Calling Another Method in Super Class in Ruby
How to Install Ruby 1.9.3 in MAC Os X Mountain Lion Without Xcode
Running into Smtp Error When Trying to Send Email in Ror App