statemon

0.5.2 • Public • Published

StateMon

Facilitates cross server socket.io-client connections for the purpose of syncing stdout, stderr, latency, probing server frontends and of course sharing state.

One Hub, many Leafs. Leafs connect to the Hub.

Examples

{ Leaf } = require 'statemon'
 
new Leaf()
################################################## 

The Hub

    hubConfig =
        secret: 'password'
 
    # These two examples are equivilent 
    hub = statemon { hub: hubConfig }
 
    { Hub } = statemon
    hub = new Hub hubConfig
    hub =
        server: [SocketIo Server# Emits events from Leafs 
 

The hub should normally only exist once.

The Leaf

 
    leafConfig =
        secret : 'password'
        host   : 'http://someplace.com:1337'
        name   : 'Server 2'
 
    # These two examples are equivilent 
    leaf = statemon { leaf: leafConfig }
 
    { Leaf } = statemon
    leaf = new Leaf leafConfig
    leaf:
        socket   : [SocketIoClient Socket# Emits events from the Hub 
        ###
            Modifiable listeners for Hub events, each bound to the leaf instance with .bind()
            Modify this only BEFORE .listen() is called to overwrite default listeners.
        ###
        listeners : {}

Leafs exist on seperate processes/servers to other leafs/the hub. Leafs communicate with only the hub, and the hub to them.

TODO

  • Need to flesh out commands for leafs.
  • Hub LeafSession event listener flexibility/flesh out and documentation

Readme

Keywords

none

Package Sidebar

Install

npm i statemon

Weekly Downloads

0

Version

0.5.2

License

none

Last publish

Collaborators

  • nfour