[英]WebRTC and Websockets. Is there a difference
I'm assuming that WebRTC is an API that decodes/encodes audio and video, although the communication between the server and the clients is done via web sockets, or some other network protocol? 我假设WebRTC是一个解码/编码音频和视频的API,虽然服务器和客户端之间的通信是通过Web套接字或其他网络协议完成的? I'm a bit confused.
我有点困惑。 Does WebRTC have its own communications protocol?
WebRTC有自己的通信协议吗?
There's two sides to WebRTC. WebRTC有两个方面。
getUserMedia
) that allow an app to access camera and microphone hardware. getUserMedia
),允许应用访问摄像头和麦克风硬件。 You can use this access to simply display the stream locally (perhaps applying effects ), or send the stream over the network. PeerConnection
, an API that allows browsers to establish direct peer-to-peer socket connections. PeerConnection
,一种允许浏览器建立直接对等套接字连接的API。 You can establish a connection directly to someone else's browser and exchange data directly. Take a look at the demos to see both parts of WebRTC in action. 看一下演示 ,看看WebRTC的两个部分是否正常运行。
So in a nutshell: 简而言之:
PeerConnection
allows full-duplex communication between two browsers. PeerConnection
允许两个浏览器之间的全双工通信。 WebRTC uses RTP (a UDP based protocol) for the media transport, but requires an out-of-band signaling channel to setup the communication. WebRTC使用RTP(基于UDP的协议)进行媒体传输,但需要带外信令信道来建立通信。 One option for the signaling channel is WebSocket.
信令通道的一个选项是WebSocket。
Instead of peerConnection
you can also look at the WebRTC data channel draft: http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-00 which is basically bidirectional udp. 您还可以查看WebRTC数据通道草案而不是
peerConnection
: http : peerConnection
,它基本上是双向的udp。 Which can be a really valuable alternative to WebSockets as doesn't have the "negative" sides of a tcp connection. 这可能是WebSockets的一个非常有价值的替代品,因为没有tcp连接的“负面”。
No, Signaling is not defined by WebRTC. 不,WebRTC没有定义信令。
Here is an post by the IETF which explains it pretty good why it is not: http://www.ietf.org/mail-archive/web/rtcweb/current/msg01143.html 以下是IETF的一篇文章,它解释了为什么它不是这样的: http : //www.ietf.org/mail-archive/web/rtcweb/current/msg01143.html
This means that you are free to choose how you exchange network information. 这意味着您可以自由选择交换网络信息的方式。 Ie you could use websockets, HTTP and even Email, but that would be a bit of a struggle :)
即你可以使用websockets,HTTP甚至电子邮件,但这将是一个有点困难:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.