FirebaseRTC icon indicating copy to clipboard operation
FirebaseRTC copied to clipboard

bug on the sample code

Open dotku opened this issue 5 years ago • 1 comments

the sample code

roomRef.onSnapshot(async snapshot -> {
    console.log('Got updated room:', snapshot.data());
    const data = snapshot.data();
    if (!peerConnection.currentRemoteDescription && data.answer) {
        console.log('Set remote description: ', data.answer);
        const answer = new RTCSessionDescription(data.answer)
        await peerConnection.setRemoteDescription(answer);
    }
});

should use => instead of ->

on this page: https://webrtc.org/getting-started/firebase-rtc-codelab

dotku avatar Aug 25 '20 19:08 dotku

another bug on sample code

  const roomRef = await db.collection('rooms').add(roomWithOffer);
  const roomId = roomRef.id;

Need to turn const roomId into a global variable roomId Otherwise, in the state of no callee, the caller execution hangup will not delete the room on firestore, because the roomId is null.

dzjones26 avatar May 24 '21 16:05 dzjones26