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);
});
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();
});
});
Documentation of the API.