Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda