@cio/duplex-emitter
Use two way event system for client/server communication.
Uses module duplex-emitter.
Install
npm install @cio/duplex-emitter --save
Usage
Uses duplex-emitter
to setup a two-way remote event communication.
Enable it with the duplexEmitter:true
options property and it will produce a socket.duplexEmitter
sub-property and emit a 'duplex-emitter' event.
var buildCio = require('cio')
, cio = buildCio();
cio.onClient('@cio/duplex-emitter');
cio.onServerClient('@cio/duplex-emitter');
var fn = require('@cio/duplex-emitter');
cio.onClient(fn);
cio.onServerClient(fn);
var options = { duplexEmitter:true }
, client = cio.client(options)
, server = cio.server(options);
client.on('duplex-emitter', function(emitter, socket) {
emitter.on('some-event', someListener);
});
MIT License