ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 69 forks source link

await Client.join never finishes (neither resolve nor reject) when RtcPeerConnection fails. #217

Open miseifert opened 3 years ago

miseifert commented 3 years ago

Currently if the peer-connections fail then the join or better to say the returned apiReady (https://github.com/pion/ion-sdk-js/blob/1e7603187c89afd15a83c6b8287b03149de42b06/src/client.ts#L117-L139) Promise never resolves or rejects leading to a complete stall.

This is because the apiReady only resolves on datachannel events, but if the connections fail then there will never be a datachannel. It also never rejects. So in case the Role.sub connection never connects it will never resolve but also never reject.

A simple example is using a configuration without stun/turn and then trying to connect two devices from different networks (in my case it's a different problem and more involved but probably too distracting here).

Not sure if this template really applies because I managed to reproduce it on all browsers and with multiple ion-sfu versions. I hope it's okay if I don't fill it out.