router.pipeToRouter() cleanup

We use pipeToRouter successfully to forward audio from one router into another router on the same server and everyone in that room is able to hear the audio. This is used by a teacher to make announcements in breakout rooms.

My question is, when the original source stream goes away, how should we cleanup the pipe that was used? How do I destroy the pipe without causing issues and memory leaks?

Thanks!

Just close the pipeConsumer or pipeProducer that the pipeToRouter () method returns. The PipeTransport will still exist to be reused if you call pipeToRouter () again in same router1 with same router2 as target.

4 Likes

That’s easy. Thanks!