Possibility to send data to individual end point with directTransport

Hey guys, is it possible to send data to individual end points with directTransport ? Is it a good practice to create a dataProducer for each endpoint ? Thanks

You can create data producer on direct transport and corresponding data consumer on other transport (for browser client for instance) and vice versa. So yes, this way you can send messages to specific clients.

Well, it depends on your use case. If you need it - you need it. If you don’t - you can connect multiple consumers to the same producer and have a broadcast.

3 Likes

A DirectTransport allow you to create a DataProducer in Node.js that can send direct messages from Node to the mediasoup Router. Then you need a WebRtcTransport and the corresponding DataConsumer for consuming those messages and deliver them to the WebRTC endpoint.

And vice-versa.

I understand, the question was - is it the best practice to create multiple dataProducers with one directTransport in order to send data to end points individually rather than broadcasting with just one dataProducer.

That depends on whether you need to send the same messages to all endpoints or not. Up to your app.