/* 此处放置各种散乱的东西…… */
1. WebRTC vs. WebSocket
There's two sides to WebRTC.
- PeerConnection, an API that allows browsers to establish direct peer-to-peer socket connections. You can establish a connection directly to someone else's browser and exchange data directly. This is very useful for high-bandwidth data like video, where you don't want your server to have to deal with relaying large amounts of data.
Take a look at the demos to see both parts of WebRTC in action.
So in a nutshell:
- WebSockets allow full-duplex communication between a browser and a web server.
- WebRTC's PeerConnection allows full-duplex communication between two browsers.