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

147
Vistas
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 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