1.2.2 • Published 5 years ago

@malgo-fe/windmill-server v1.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

windmill server

windmill

windmill is simple service to notify all clients of an app some events, such as version upgrade.

It is designed to be easily integrated into continous deploy.

usage

const ConfigManager = require('../dist/config_manager');
const WindmillServer = require('@malgo-fe/windmill-server');
const cm = new ConfigManager({ apps: [{ name: 'mhra', token: '123456' }] });

const server = new WindmillServer({ configManager: cm });
server.start();
// console.log(util.inspect(ConfigManager));

Add add a config file at your home directory.

~/.windmill_config:

apps:
  - name: mhra
    token: xxxxxx

endpoint

  • POST /listen
  • body:
{
  "app": "mhra",
  "token": "xxxx",
  ...
}

When a post request is sent to the endpoint, the socket will broadcast a message to all clients listened on the app channel to get notified that the app has a new version.

socket

Every app has a channel, and a client connected will enter the channel and receive the update message when a request posted to the endpoint.

integrate in CI

TODO: