Reusable PlainTransport for different producers

Hi All,

I wonder how I can reuse producer/consumer plainTransport ?

for producer:
Step 1: transport.createPlainTransport(options)
Step 2: transport.produce(rtpSendParams)

for consumer:
Step 1: transport.createPlainTransport(options)
Step 2: transport.connect(remoteIp, remotePort)
Step 3: transport.consume(producerId, rtpParams)

In by executing steps first for producer and then for consumer, successfully work. But When I disconnect producer and reconnect it, and only updating step3 for consumer with newProducerId doesnt work.

I thought by only changing producerId for consumer and calling .consume(newProducerId) will succesfully work, but it didnt. Can anybody tell me how I can reuse plainTransport for consumer?


What do you mean by this? You mean you close the producer and call producer again or you mean that you close producer and transport as well?

when I say disconnecting producer;
I mean disconnection of producer (closing producer transport and producer.close())
So when I reconnect producer, I create new transport for it and then with new producer transport I call transport.produce(rtpSendParams)

Got it, it is not going to work like that because you are closing the producer transport.

So if you close only the producer and not transport then you should be able to consume that new producer by calling .consume on consuming end like you are doing now.

But if you need to close the producing transport then I guess you will have to alteast call .connect() with new remote ip and port, and then you can call .consume, if it doesn’t work then I am afraid you will have to create, connect, consume transport again on consuming end.