Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signaling server via firebase firestore #129

Open
oguzveozturk opened this issue Mar 24, 2023 · 0 comments
Open

Signaling server via firebase firestore #129

oguzveozturk opened this issue Mar 24, 2023 · 0 comments

Comments

@oguzveozturk
Copy link

I'm trying to use Firestore for a signaling server, and I want to explain how I solved the problem i had:

When we click the Offer button, an SDP is created, but it does not contain any candidates. After 1-2 seconds, candidates are created and localDescription is updated without our knowledge. The problem is that we send already an SDP to the other user that does not contain candidates.

My not-so-smart solution:

        self.webRTCClient.offer { (_) in
            DispatchQueue.main.asyncAfter(deadline: .now()+1) { // maybe 2 seconds delay better
                self.webRTCClient.offer { (sdp) in
                       self.send(sdp: sdp)
                }
            }
        }

This problem also occurs when we click the Answer button. The initially created SDP does not contain any candidates. Therefore, we need to add a similar logic there as well:

        self.webRTCClient.answer { (_) in
            DispatchQueue.main.asyncAfter(deadline: .now()+1) {
                self.hasLocalSdp = true
                if let localSdp = self.webRTCClient.peerConnection.localDescription {
                    self.send(sdp: localSdp)
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant