Question

Can I use Websocket to send RTP over?

I assume Websocket is just a way to establish permanent TCP connection to another point and avoid message overhead. So, it seems I can use whatever it was possible to use over TCP. Is that sounds correct?

Was it helpful?

Solution

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 (i.e. server) needs to have logic to process the initial request and use the headers to establish the channel. Websockets use TCP, they are not like 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. You cannot use WebRTC to pick the RTP packets and send them over a protocol of your choice, like WebSockets. You can refer to this other answer about this.

UPDATE

If you have an RTP packet in your Javascript code, you can send it over WebSocket (e.g. Base64 encoded). 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top