Concentrating on the producer side only for now, I have seen some implementations, which prepare this sequence once at the time their JS client joins a room:
- server-side “createWebRtcTransport” is called on behalf of the client
- result is used for client-side createSendTransport
- “connected” event of the createSendTransport is used to trigger the server-side “connect” function
- “produce” callback is waiting for the client-side trigger (sendTransport.produce) and things are going well
I also have seen implementations, which do all the described setup stuff with every single “produce” request from the client. From own experience I can tell, that works too.
Now I’m in doubt, what would be the better approach:
-
Having server-side webRtcTransport and client-side sendTransport up and connected once during app initialization and just re-using it with every new producer come and go?
-
Doing it all in a single sequence as described.
As said. Both approaches are working for me. I just do not know what e.g. would be the recommended approach w.r.t. resource-usage and maybe WebRTC hidden secrets.
TIA