简体   繁体   English

Websocket上的RTP

[英]RTP over Websocket

Can I use Websocket to send RTP over? 我可以使用Websocket发送RTP吗?

I assume Websocket is just a way to establish permanent TCP connection to another point and avoid message overhead. 我认为Websocket只是建立到另一点的永久TCP连接并避免消息开销的一种方法。 So, it seems I can use whatever it was possible to use over TCP. 因此,似乎我可以使用在TCP上可以使用的一切。 Is that sounds correct? 听起来正确吗?

Yes and no. 是的,没有。

You can send any data over a websocket connection, but it will not be just like a TCP connection, as the other endpoint (ie server) needs to have logic to process the initial request and use the headers to establish the channel. 您可以通过websocket连接发送任何数据,但它不会像TCP连接那样,因为另一个端点(即服务器)需要具有处理初始请求并使用标头建立通道的逻辑。 Websockets use TCP, they are not like TCP. Websocket使用TCP,它们不像TCP。

Regarding the part about RTP packets and seeing that you added the tag webrtc , WebRTC can be used to create and send RTP packets, but the RTP packets and the connection is made by the browser itself. 对于有关RTP数据包的部分,并看到已添加标签webrtc ,可以使用WebRTC创建和发送RTP数据包,但是RTP数据包和连接是由浏览器本身进行的。 You cannot use WebRTC to pick the RTP packets and send them over a protocol of your choice, like WebSockets. 您不能使用WebRTC来选择RTP数据包并通过您选择的协议(例如WebSockets)发送它们。 You can refer to this other answer about this . 您可以参考有关此的其他答案

UPDATE UPDATE

If you have an RTP packet in your Javascript code, you can send it over WebSocket (eg Base64 encoded). 如果您的Javascript代码中有RTP数据包,则可以通过WebSocket发送它(例如,Base64编码)。 But the real problem is that you will not have RTP packets neither data to build them if you use WebRTC, as everything is inside the browser code and not accessible via JavaScript. 但是真正的问题是,如果您使用WebRTC,则将不会有RTP数据包,也没有数据来构建它们,因为所有内容都在浏览器代码内,并且无法通过JavaScript进行访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM