I need to do this to to reduce latency since the site will require that the input from one of the users to be transmitted to the other user as soon as possible so sending data from client A to Server and then to client B is not a good option.
I read previous posts on this subject but there were no working solution/examples available that I could find. From what i read the direct connection between clients can be made using plugins like Silverlight, Java or Flash.
Here on Stackoverflow are several topics about P2P connections in browsers:
As mentioned in most of the topicts, both 2008 HTML5 working drafts were having a section "Peer-to-peer connections":
Since the W3C Working Draft 12 February 2009 the section "Peer-to-peer connections" disappeared. But this P2P connection is not gone. It's back under the name PeerConnection within the WebRTC (Real-Time Communications) specifications:
Since 31 October 2011, the W3C Editor's Draft is an official Working draft:
The only implementation of the PeerConnection (UDP based) exists in the modified WebKit by the Ericsson labs (May 2011), which is working quite well. Some patches are in WebKit now (Oct. 2011 -- see updates below!):
Additionally, the WebRTC initiative is a project by Google, Mozilla and Opera. Thus, they are continuing the specification on PeerConnection:
Probably Chrome (uses WebKit) will be the first major browser supporting WebRTC with PeerConnection:
Since 18th January 2012, Chrome is supporting WebRTC as well. It can be uses in the Dev channel (Windows, OSX, Linux) and the Canary build (Windows and OSX) by enabling it under
chrome://flags. It only only supports
MediaStream like Video and audio and can be tested with several Demos. Transferring application data like
ArrayBuffer/... is not supported until now.
Since 16th March 2012, the WebRTC Editor's Draft separates a "Peer-to-peer Data API" to send and receive generic application data (
Blob). Chromium wants to implement the Data API soon (10th April 2012).
On April, 3rd, Mozilla published a first working example on WebRTC for Firefox as well.
DataChannel is planned for version 25 of Chrome, behind a flag, meanwhile it can be tested in Firefox Nightly/Aurora (12th December 2012):