CodeDezk
CodeDezk

Reputation: 1260

Webrtc ICE candidate exchange between peer

I have few doubt about webrtc peer to peer implementation.

  1. Is it necessary to exchange ice candidate between peer.

When I check sample code I found that

// send any ice candidates to the other peer
pc.onicecandidate = ({candidate}) => signaling.send({candidate});

........................
........................
signaling.onmessage =...........
......................
if (candidate) {
  await pc.addIceCandidate(candidate);
  1. Does the onicecandidate triggered on both peer or in offer peer only ?

I tested that without exchanging icecandidate the video stream works.

Does it create any problem in certain condition.

Upvotes: 1

Views: 355

Answers (1)

Biju Kalanjoor
Biju Kalanjoor

Reputation: 552

ICE Candidate will help to find the shortest path to the peer. Also onIceCandidate will trigger on both peer.

Note: I tried without sending candidate to other peer that is not works for me.

Upvotes: 1

Related Questions