0

I have a problem with WebRTC group chatting. [I have achived this on my code]

  1. client-1 create's offerSDP for client-2
  2. client-2 accepts the offerSDP and replay answerSDP to the client-1 (the creator)
  3. client-1 accept and set it as remoteDescription. Now video chat happening.

fine,

Now client-3 comes in.

In my code client-3 receives client-1's offerSDP and emit's answerSDP to all the client's present in the server.

  1. Now Both client-1 and client-2 will get the answerSDP from client-3 and both will recevies client-3's video.

Problem:

  1. client-1 has [localvideo, client-2_video, client-3_video]
  2. client-2 has [localvideo, client-1_video, client-3_video]
  3. client-3 has [localvideo, client-1_video]. Here this client not knowing about client-2

why? what i have to do here? Helo me please.

1 Answers1

1

You need to exchange a unique offer/answer pair for each connection. It's not possible to re-use them for different connections.

In your example client-3 would need to receive an offer from client-1 AND client-2. And it would need to send a unique answer to both of those other clients as well.

chrisguttandin
  • 7,025
  • 15
  • 21
  • 2. Question: Why we need exchange 'iceCandidate'. without exchanging that, by only accepting local and remote description media flows good in my code. I did not use 'addIceCandidate' event in my code. what happen's for client-1 when added client-2's iceCandidate. – mohamed thalif Aug 11 '22 at 08:59
  • Each candidate can be thought of as an address of the client. It helps the other client to connect. If your testing on the same computer you might be able to connect without exchanging any of the candidates. – chrisguttandin Aug 11 '22 at 11:51