poly-socketio
v1.1.5
Published
Polyglot SocketIO server that allows cross-language communication via JSON
Downloads
396
Maintainers
Readme
poly-socketio
Polyglot SocketIO server that allows cross-language communication via JSON
Installation
npm i --save poly-socketio
Usage
This is used in AIVA to communicate JSON data among the Nodejs, Python and Ruby runtimes.
const polyIO = require('poly-socketio')
const IOPORT = 6466
var ioPromise = polyIO.server({port: IOPORT, clientCount: 1, timeoutMs: 15000, debug: false})
polyIO.client({port: IOPORT}) // this exposes a global.client
var msg = {
input: 'hello js',
to: 'echo.js',
intent: 'ping'
}
global.client.pass(msg)
.then((reply) => {
if (reply.output === 'ping hello js') {
console.log('success!')
} else {
console.log('error')
}
})