UNPKG

thintalk

Version:

Very thin RPC layer using TPC and IPC

28 lines (22 loc) 480 B
/** * Copyright (c) 2012 Andreas Madsen * MIT License */ var common = require('../common'), thintalk = require(common.modulePath); var listener = thintalk({ add: function (a, b) { this.callback(a + b); }, fail: function () { throw "error"; } }); if (process.argv[2] === 'IPC') { listener.listen('IPC', process); } else if (process.argv[2] === 'TCP') { listener.listen('TCP', common.PORT); } listener.on('listening', function () { process.send('ready'); });