octo-sansa

2.0.3 • Public • Published

octo-sansa

CI Status Version License

A very simple TCP (client/server) messaging layer

Getting started

A simple "echo" server:

 
const octo = require('octo-sansa');
 
const server = octo.createServer();
 
server.on('connected', client => {
  client.on('echo', (body, callback) => {
    console.log('Client said', body);
    callback(undefined, body);
  });
});
 
server.listen(1234, () => {
  console.log('Server listening on ' + server.address().port);
});
 

A simple "echo" client:

 
const octo = require('octo-sansa');
 
const client = octo.createClient(1234, 'localhost');
 
client.on('connect', () => {
  client.ask('echo', 'Say hello server', (err, response) => {
    console.log('The server said', response);
    client.close();
  });
});
 

TODO

Documentation of the API.

Readme

Keywords

none

Package Sidebar

Install

npm i octo-sansa

Weekly Downloads

15

Version

2.0.3

License

MIT

Last publish

Collaborators

  • patrick