# statemon

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

Latest version **0.5.2** (published 2015-05-04) · 0 weekly downloads

## Install

```sh
npm install statemon
pnpm add statemon
yarn add statemon
bun add statemon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2015-05-04 |
| First published | 2015-01-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | nfour |
| Maintainers | nfour |

## Links

- npm: https://www.npmjs.com/package/statemon
- npm.io page: https://npm.io/package/statemon

## Dependencies (2)

- [socket.io](https://npm.io/package/socket.io.md) 1.3.x
- [socket.io-client](https://npm.io/package/socket.io-client.md) 1.3.x

## Recent versions

- 0.5.2 (latest) — 2015-05-04
- 0.5.1 — 2015-02-03
- 0.5.0 — 2015-01-29
- 0.4.1 — 2015-01-28
- 0.4.0 — 2015-01-28
- 0.3.2 — 2015-01-28
- 0.3.1 — 2015-01-28
- 0.3.0 — 2015-01-28
- 0.2.1 — 2015-01-28
- 0.2.0 — 2015-01-28

## README

# 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
```coffee
{ Leaf } = require 'statemon'

new Leaf()
##################################################
```

### The Hub

```coffee
	hubConfig =
		secret: 'password'

	# These two examples are equivilent
	hub = statemon { hub: hubConfig }

	{ Hub } = statemon
	hub = new Hub hubConfig
```
```coffee
	hub =
		server: [SocketIo Server] # Emits events from Leafs

```

The hub should normally only exist once.

### The Leaf

```coffee

	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
```
```coffee
	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

---
_Source: https://npm.io/package/statemon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
