According to Split sender and receiver Transport classes · Issue #686 · versatica/mediasoup · GitHub, mediasoup-client and libmediasoupclient objects are unidirectional just only due to complexities in management of bi-directional SDPs. Not fully sure if due to a misunderstood, but I’ve created with mediasoup-client both a WebRTCSendTransport and a WebRtcRecvTransport, and server side a single WebRtcTransport object.
After that, I registered the connect
event in both clients to send their dtlsParameters
parameters to the server and there call to connect()
method. First one works, but second ones throw an error about Transport already connected. If I don’t register the connect
event in the second client-side Transport (the sender one), I get an error about not being registered, so I just register a dumb handler that just call the callback as a sucesfully connection… and seems to work or at least I can get video flowing in.
I still needs to check if I can send data too, but in any case it seems a bit hacky to me, so I want to ask: does it makes sense what I’m doing? I’ve just reviewed the sent info and seems to me there’s nothing related the Transport is intended to receive or send info (maybe the role
field?):
424["transport_connect",{"transportId":"3b652ddc-2103-470a-82cd-95077545baa1","dtlsParameters":{"role":"client","fingerprints":[{"algorithm":"sha-256","value":"11:F7:9D:56:26:24:E8:07:9E:7F:B9:8B:D6:3C:B3:1F:82:7F:42:26:50:82:FE:42:1D:55:A2:3D:FB:44:22:1C"}]}}]
If this is a (hacky) valid use case, shouldn’t connect()
method just ignore the second call instead of throwing an error? Should I capture and check it instead, in case there would have been any other error? Maybe detect that I’ve already called it once and don’t try to call it again?