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

148
Visualizações
Check/observe every 5s for change in service and update output

I have a function that gets information if an adapter is connected:

private registerAdapter() {
    this.register(GetAdapter, Action.Get, async (): Promise<IData<AdapterInfo>> => {
      await this.setup;
      if (!this.myClient?.canGetAdapter()) {
        return Promise.reject('My client is not able to get connected adapter');
      }

      const adapter = await this.myClient.getAdapter();
      if (!adapter) {
        return Promise.reject('My communication client is not able to get adapter');
      }

      return {
        data: {
          adapter
        },
        read: new Date()
      };
    });
  }

Above will work, and I get the info if an adapter is connected. However, if the adapter is disconnected during runtime, the information will not be updated and it will still say "Connected".

I want, when the adapter is connected, return this information and then "observe" the service every 5s and if the response is null, return the new results. How to do that? Flow should be something like:

Service: adapter is connected, return data Observe every 5s for change in service Service: adapter is disconnected, return null Observer catches the change and the function will return null

about 4 years ago · Juan Pablo Isaza
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