The dtlsParameters object in transport.produce(options)

Hi to the community!

I’m using the library for a broadcasting application. Before that I am trying to test the procedure on a demo app to ensure that the logic works. I can make device, load it, then create the produce transport successfully.

In the next step when I’m trying to call producer = await transport.produce(options) to get the produce I don’t get any response. I tracked function in the library and found that this issue happens in the produce method of transport when i’m trying to get the rtpParameters from the handler Interface.

As I searched more deeply in the library I found that the root of the issue comes from the setupTransport method of the handler Interface and this line:

await this.safeEmitAsPromise('@connect', { dtlsParameters });

So I logged the dtlsParameters on my project and one of the demo projects on www.mediasoup.org and the variables are the same but I still don’t get any response from the mentioned line.

So I will be glad if you know what the issue is about.

Thank you very much beforehand!

This is documented in the website. Look for client and server communication section. You must listen for “connect” even in transport before calling transport.produce() or consume() and honor that event expectation.

Thank you for your response @ibc

Yes I have done that. When I initialize the transports I listen for both “connect” and “produce” if you mean that.
When the transport.produce() is called, “connect” is being emitted and the transport gets connected but “produce” doesn’t emit anyway.

When connect is emitted it doesn’t yet mean that transport is connected. You need to send DTLS parameters to the server, receive server’s DTLS parameters and call a callback function to actually finish connection. Then produce will be fired.

Please confirm whether you have followed the documentation I told you or not. Listening for the “connect” event is not enough.

Yes I followed the documentation and I am listening for “connect” in transport in client. In the listener I emit an event to the server and the transport.connect() method is being called in the server side.

Thank you for your time and response @nazar-pc

Yes I know. I send the dtlsParameter to the server in the “connect” listener of transport.
In the server side transport.connect({ dtlsParameters }) is being called and I get a success message in the client side.

Thank you @ibc and @nazar-pc for your time. I really appreciate that!

My problem was that I didn’t call the callBack() for the listeners.

1 Like