Skip to content

Signaling server via firebase firestore #129

Description

@oguzveozturk

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)
                }
            }
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions