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

196
Visualizações
Checking participants of a Twilio Video room before connection

I have a 1:1 person to person room scenario where I want to make sure that they haven't accidentally connected already before entering. So Person A can only have 1 instance and person 2 can only have one instance. The most recently opened instance supersedes the previous and disconnects their previous one. I am using twilio-video npm package and Next JS and I have the rooms all working great like this.

async function connectToRoom(roomId, userType, tracks) {
  //Create a Access Token to connect to the room
  const credsP1 = await getRoomCredentials(roomId + '-' + userType)
  const room = await Video.connect(credsP1.token, {
    name: roomId,
    audio: { name: 'microphone' },
    video: { name: 'camera' },
    tracks: tracks,
  }).catch((error) => {
    if ('code' in error) {
      // Handle connection error here.
      console.error('Failed to join Room:', error.code, error.message)
    }
  })
}

In my useEffect() Next JS function how can I check to see if I have already connected? I would be able to use the userType keyword to check if I am PersonA or PersonB

I can't quite get this code translated to the twilio-video I am using

  client.video.rooms(roomId)
        .fetch()
        .then(room => console.log("check users and do my stuff here"));

Can anyone help get this function working?

Thanks

about 4 years ago · Santiago Gelvez
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