Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
How to await candidates in WebRTC?

Is there any easy way to await the full completed with candidates ? We can await the offer & description, but I dont see a way to await the candidates (full sdp to be sent to the signalling server).

E.g.:

const pc = new RTCPeerConnection(configuration);
const sendChannel = pc.createDataChannel("sendChannel");
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);

// need something like this;
await pc.onIceCandidateComplete();; 

// send the offer to signaling server once we have all the data.
send(offer);

I see there oniceconnectionstatechange(), and onicecandidate() that can be used, but none support await async, or I can't find a good example.

Has anyone come up with a good solution for this or is there some reason to not have this functionality? What's the best way?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is no directly awaitable event. You can use a construct like the waitUntilEvent function found here:

await (new Promise(r => {
  pc.addEventListener(
    'icegatheringstatechange',
    () => pc.gatheringState === 'complete' && r()
 )
}));

Note however that this state change can take a lot of time (30s+) in certain cases. This bug has some notes. Typically you'll want to wait for other conditions like the first relay candidate or add a timeout.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda