title: Keep Checking: Angular Observable from Promise
body: <p>I am developing an angular app which connects to the printer. The printer has its own status service which is a promise and it responds with printer status. In my angular app, I need a functionality where I need to keep checking status of the printer in the background. For this I am trying to use observable and subscribe function which is not working as expected.</p>
  <p>In my <strong>PrinterService.ts</strong> component, I have defined the function as:</p>
  <pre><code>getStatus() {
    return from(cordova.xyz.getPrinterStatus()); // getPrinterStatus() is a promise
  }
  </code></pre>
  <p>And I am consuming this function in my <strong>HomePage.ts</strong> as:</p>
  <pre><code>this.printerService.getStatus().subscribe( (res) =&gt; {
    console.log(&quot;Printer Status&quot;, res);
  }
  </code></pre>
  <p>The problem here is I am getting the status response but just once. For example, if my printer is on, it will give me &quot;on&quot; status but it just prints inside console as once. But when after 2-3 minutes, if I switch off the printer, it should give me status as &quot;off&quot;. How do I make this work in such as way that my getStatus() services automatically looks for printer status? Any help is greatly appreciated. Thanks.</p>