1.1.2 • Published 6 years ago

@kraftend/automation-client v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Automation Client Module

This package is intended for using with private automation server.

Usage

Installation

npm i @kraftend/automation-client --save 
// OR
yarn add @kraftend/automation-client

Sample Code

const Automation = require('@kraftend/automation-client')
const automation = new Automation()
automation.connect()

automation.on('start', function() {
  // START YOUR APPLICATION HERE
  
  // after doing some hard work
  // you can call this method to update status
  automation.emit('app:status', 1)
})

automation.on('stop', function() {
  // STOP YOUR APPLICATION HERE
  
  // after doing some hard work
  // you can call this method to update status
  automation.emit('app:status', 0)
})

Status Updates

You should check your application status regularly and report any changes with automation.emit('app:status', statusCode)

This module continuously check the system and process status, and keep the connection alive with heartbeats. You don't need to implement any heartbeat or connection status checks.

Events

You can listen any events triggered by automation server.

automation.on('start|stop|customEvent...', function(data) {
  //do something
})

Currently available events:

  • start
  • stop
  • connect
  • disconnect
  • registered
  • unregistered