poly-socketio

1.1.5 • Public • Published

poly-socketio npm version CircleCI Code Climate Test Coverage

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')
    }
  })

Package Sidebar

Install

npm i poly-socketio

Weekly Downloads

83

Version

1.1.5

License

MIT

Last publish

Collaborators

  • kengz