Is it possible to create a website that makes possible this scenario:
User A logs into the website, uploads a file making a direct TCP connection to user B that it is within the same site at same time downloading the file. Without passing the file trough the server.
How to make user B to listen through a browser?
Would this violate “Same origin policy”?
Point is to use browser and no other software like P2P clients.
Is this crazy idea possible?
I doubt webRTC covers exactly what you need.
You have two issues:
The solution is to use/implement a relay server:
Easier said than done…. (and yes it is a feature of advanced P2P networks like JXTA, XMPP, Skype…, and yes you unfortunately need an intermediate server)
Check ICE for a specification of ‘how to do NAT traversal’