{"dist":{"shasum":"31c3360c0243f7900d8c69b8d66d500c435f80fa","tarball":"https://registry.npmjs.org/remote-events/-/remote-events-1.1.1.tgz","integrity":"sha512-wDfCiv9f+2/sqkilCNqkxzsEIauCb4iF8yYxd1Xs4qc7z4e8lt5cUCPEqsXlfTMWewDXX7BlGhtP9a94o4UenA==","signatures":[{"sig":"MEUCIQC4JPh0hJZd9SSoYG+VfFq1sVaBS9xZvAVfl/KqnGbd+gIgbM0RYA4zpHoss+dd/I9pyfj3SaWDUc09M4w422Zxezg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"name":"remote-events","author":{"url":"dominictarr.com","name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"readme":"# RemoteEvents\n\nconnect two EventEmitters through a stream!\n\n``` js\nvar RemoteEventEmitter = require('..')\nvar es = require('event-stream')\nvar net = require('net')\n\nvar server = net.createServer(function (con) {\n  var ree = new RemoteEventEmitter()\n  con.pipe(ree.getStream())\n\n  ree.on('ping', function (time) {\n    console.log('PING', time)\n    ree.emit('pong', Date.now())\n  })\n}).listen(2468, function () {\n \n  var con = net.connect(2468)\n  var ree = new RemoteEventEmitter()\n  con.pipe(ree.getStream()).pipe(con)\n\n  var time = Date.now()\n  ree.on('pong', function (_time) {\n    console.log('PONG', _time, _time - time)\n    ree.disconnect()\n    server.close()\n  })\n  ree.emit('ping', time)\n})\n\n```\n\nnow, one may wish to subclass `RemoteEventEmitter` wrap `net` or `http` or [shoe](http://github.com/substack/shoe) and provide a `connect` and `createServer` methods.\n\nthen you will have a very [socket.io](http://socket.io) like interface (but without the silly bundled RPC, etc)\n\nhowever, I recommend instead wrap this with [browser-stream](http://github.com/dominictarr/browser-stream) -- which will allow you to multiplex streams through `RemoteEventEmitter`\n\nwhich will be useful for A) keeping nice `Stream` abstractions when you have a limited budget for connections (like in the browser) and B) seperating interprocess communication abstractions (such as [dnode](http://github.com/substack/dnode) or [crdt](http://github.com/dominictarr/crdt). This has been a problem with libraries using the socket.io api directly.\n\n\n","homepage":"http://github.com/dominictarr/remote-events","repository":{"url":"https://github.com/dominictarr/remote-events.git","type":"git"},"description":"a two ended EventEmitter connected through a Stream","directories":{},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"dependencies":{"through":"0","event-stream":"~2.1"},"devDependencies":{"assertions":"2"},"_id":"remote-events@1.1.1","version":"1.1.1"}