2.0.16 • Published 7 years ago

sugo-observer v2.0.16

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

Build Status npm Version JS Standard

Remote observer for SUGOS

SUGO-Observer works as a client of SUGO-Hub and provides accessors to observe the cloud server status.

Requirements

Installation

$ npm install sugo-observer --save

Usage

#!/usr/bin/env node

/**
 * This is an example to use observer to observe hub
 */
'use strict'

const sugoObserver = require('sugo-observer')

async function tryExample () {
  let observer = sugoObserver((data) => {
    console.log('Data changed:', data)
    /* ... */
  }, {
    host: 'my-sugo-hub.example.com'
  })

  await observer.start() // Start observing
  /* ... */
  await new Promise((resolve) => setTimeout(resolve, 80000))
  await observer.stop() // Stop observing
}

tryExample().catch((err) => console.error(err))

License

This software is released under the Apache-2.0 License.

Links