Skip to content

Polyglot SocketIO server that allows cross-language communication via JSON

License

Notifications You must be signed in to change notification settings

kengz/poly-socketio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Polyglot SocketIO server that allows cross-language communication via JSON

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •