Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!