# centralio

> Centralio is a library for creating applications with many clients and a central server based on the UDP protocol.

Latest version **0.0.13** (published 2017-12-20) · MIT license · 0 weekly downloads

## Install

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

## 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.0.13 |
| Published | 2017-12-20 |
| First published | 2017-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Francesco Bianco |
| Maintainers | francescobianco |

## Links

- npm: https://www.npmjs.com/package/centralio
- Repository: https://github.com/javanile/centralio
- Homepage: https://github.com/javanile/centralio#readme
- Issues: https://github.com/javanile/centralio/issues
- npm.io page: https://npm.io/package/centralio

## Dependencies (2)

- [md5](https://npm.io/package/md5.md) ^2.2.1
- [colors](https://npm.io/package/colors.md) ^1.1.2

## Recent versions

- 0.0.13 (latest) — 2017-12-20
- 0.0.12 — 2017-12-20
- 0.0.11 — 2017-12-20
- 0.0.10 — 2017-12-20
- 0.0.9 — 2017-12-19
- 0.0.8 — 2017-12-19
- 0.0.7 — 2017-12-19
- 0.0.6 — 2017-12-19
- 0.0.5 — 2017-12-19
- 0.0.4 — 2017-12-09
- 0.0.3 — 2017-12-09
- 0.0.2 — 2017-12-09

## README

# Centralio
Centralio is a library for creating applications with many clients and a central server based on the UDP protocol.

[![Build Status](https://travis-ci.org/javanile-bot/centralio.svg?branch=master)](https://travis-ci.org/javanile-bot/centralio)
[![Maintainability](https://api.codeclimate.com/v1/badges/1501d777dd5519cf7d2e/maintainability)](https://codeclimate.com/github/javanile-bot/centralio/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/1501d777dd5519cf7d2e/test_coverage)](https://codeclimate.com/github/javanile-bot/centralio/test_coverage)

## Get Starded
If you want use Centralio simply add dependency into your project
```bash
$ npm install centralio
```

### Your first server
```javascript
// file: server.js
// exec: node server
const server = require('centralio').server();

// Start your server 
server.start('127.0.0.1', '44044');

// Handle received messages from client
server.rx(function(client, msg) {
  console.log('Message from client:', client.id, msg);  
  // Respond to client
  client.tx('Thanks from your message.');
});
```

### Your first client
```javascript
// file: client.js
// exec: node client
const client = require('centralio').client();

// Start your client
client.start('127.0.0.1', '44044');

// Handle received message from server
client.rx(function(msg) {
  console.log('Message from server:', msg);    
});

// Send message to server
client.tx('Hi my server!');
```

## Manage client state
![Centralio Client/Server sample architecture](http://www.plantuml.com/plantuml/png/ROyn2uCm48Nt_8h3tS74GWsbIrsw5Ketbv3SbO2S46FpzqjZ5H7Nzpw-TyU3GoYU63uOuDK-Ehxr7Zb2fS4Ep6ZZ6aaD0r7l6TT8QKZ6Hy_l0im8O_O8mTcwc3g-jnhgvZmHraq6RQwg7IbdKfARY19jIBaZrTyP4fdHdJQa4cA-0YvbULs6GF-UgmygUP0fyGK0)

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