To balance and optimize usage of multiple Routers both with vertical and horizontal scaling, I’m planning to re-connect the Producers that receive data from another Consumers. I know you can use the
Transport.connect() method to open a listening port and connect to the other endpoint, but I’m not sure if this can be done when a connection is already being done or if I need to close it first. Problem is, closing the Transport will close all its Consumers, all its Producers, and the Consumers connected to that Producers, and if you control correctly the events that can generate a chain reaction and close all the downstream Producers and Consumers.
connect() method should do a reconnection with the new parameters if called twice, but I don’t know if that’s possible. If so, another alternative is to add a new
reconnect() method that adjust the Transport internal state without dispatching the
transportclose event, but don’t know how much difficult it can be.
Related to that, a Producer can have multiple Consumers since they are managed by the Mediasoup Router, but can a Consumer in a PipeTransport provide data to multiple Producers in the PipeTransports of other Routers?