{"_id":"sendmessage","_rev":"1213192","name":"sendmessage","description":"Send a cross process message if message channel is connected.","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2021-10-13T05:46:41.000Z","created":"2014-11-14T08:11:37.118Z","1.1.0":"2016-11-02T12:44:54.165Z","1.0.5":"2015-04-14T08:31:25.165Z","1.0.4":"2014-12-03T17:30:45.296Z","1.0.3":"2014-11-21T08:49:12.606Z","1.0.2":"2014-11-21T08:41:24.423Z","1.0.1":"2014-11-14T09:13:25.645Z","1.0.0":"2014-11-14T08:11:37.118Z"},"users":{},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"versions":{"1.1.0":{"name":"sendmessage","version":"1.1.0","description":"Send a cross process message if message channel is connected.","main":"index.js","files":["index.js"],"scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","istanbul":"*","jshint":"*","mm":"^1.5.1","mocha":"*","should":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"e167f7e69c7fbe82517da6e3e771ad04a52727c9","_id":"sendmessage@1.1.0","_shasum":"10a245cee2d50c759f1e09a23477b91496d09e35","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"10a245cee2d50c759f1e09a23477b91496d09e35","size":2804,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.1.0.tgz"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sendmessage-1.1.0.tgz_1478090693632_0.6716408501379192"},"directories":{},"publish_time":1478090694165,"_cnpm_publish_time":1478090694165,"_hasShrinkwrap":false},"1.0.5":{"name":"sendmessage","version":"1.0.5","description":"Send a cross process message if message channel is connected.","main":"index.js","files":["index.js"],"scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"99bdbcfff6e74c1f211e8477d70b38fb9dd43bee","_id":"sendmessage@1.0.5","_shasum":"7f483711dae4461d5b088eb8f1cc3d7fcac546c0","_from":".","_npmVersion":"2.7.5","_nodeVersion":"1.6.4","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"7f483711dae4461d5b088eb8f1cc3d7fcac546c0","size":2704,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.5.tgz"},"directories":{},"publish_time":1429000285165,"_cnpm_publish_time":1429000285165,"_hasShrinkwrap":false},"1.0.4":{"name":"sendmessage","version":"1.0.4","description":"Send a cross process message if message channel is connected.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"6db869bbe713200d240e11cc2d5a9c58f4e42556","_id":"sendmessage@1.0.4","_shasum":"1944c116d11541f670beaf9123bdff6256ec80c5","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.11.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"1944c116d11541f670beaf9123bdff6256ec80c5","size":2846,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.4.tgz"},"directories":{},"publish_time":1417627845296,"_cnpm_publish_time":1417627845296,"_hasShrinkwrap":false},"1.0.3":{"name":"sendmessage","version":"1.0.3","description":"Send a cross process message if message channel is connected.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"4391ba0c5e19a465d580f5fb9fb2ebd4a9dbaf0b","_id":"sendmessage@1.0.3","_shasum":"ff11d801bce3f5013c7506d6a4d3217823d671a6","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.11.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"ff11d801bce3f5013c7506d6a4d3217823d671a6","size":2772,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.3.tgz"},"directories":{},"publish_time":1416559752606,"_cnpm_publish_time":1416559752606,"_hasShrinkwrap":false},"1.0.2":{"name":"sendmessage","version":"1.0.2","description":"Send a cross process message if message channel is connected.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"6943d87c9bec6762fdbb7d1bb42f0126ff52be71","_id":"sendmessage@1.0.2","_shasum":"445e74a695e67a1cb6406a5ae8c4eddfcc946564","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.11.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"445e74a695e67a1cb6406a5ae8c4eddfcc946564","size":2789,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.2.tgz"},"directories":{},"publish_time":1416559284423,"_cnpm_publish_time":1416559284423,"_hasShrinkwrap":false},"1.0.1":{"name":"sendmessage","version":"1.0.1","description":"Send a cross process message if message channel is connected.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"735b540942498b3663d35035f392e518a4b54e8d","_id":"sendmessage@1.0.1","_shasum":"19920e06f4c213db4bc0b39e6a9ab18774bd079d","_from":".","_npmVersion":"2.0.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"19920e06f4c213db4bc0b39e6a9ab18774bd079d","size":2695,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.1.tgz"},"directories":{},"publish_time":1415956405645,"_cnpm_publish_time":1415956405645,"_hasShrinkwrap":false},"1.0.0":{"name":"sendmessage","version":"1.0.0","description":"Send a cross process message if message channel is connected.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{},"devDependencies":{"autod":"*","contributors":"*","should":"*","jshint":"*","istanbul":"*","mocha":"*"},"homepage":"https://github.com/node-modules/sendmessage","repository":{"type":"git","url":"git://github.com/node-modules/sendmessage.git","web":"https://github.com/node-modules/sendmessage"},"bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"keywords":["sendmessage","send","cluster","message","channel closed"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"}],"gitHead":"686bcad865c2748912f9abfd858c0a7301b9f418","_id":"sendmessage@1.0.0","_shasum":"f71877d06c122d88c896d9ed548ddaaacd2952a8","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.11.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"f71877d06c122d88c896d9ed548ddaaacd2952a8","size":2593,"noattachment":false,"key":"/sendmessage/-/sendmessage-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sendmessage/download/sendmessage-1.0.0.tgz"},"directories":{},"publish_time":1415952697118,"_cnpm_publish_time":1415952697118,"_hasShrinkwrap":false}},"readme":"sendmessage\n=======\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Gittip][gittip-image]][gittip-url]\n[![David deps][david-image]][david-url]\n[![node version][node-image]][node-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/sendmessage.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/sendmessage\n[travis-image]: https://img.shields.io/travis/node-modules/sendmessage.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/sendmessage\n[coveralls-image]: https://img.shields.io/coveralls/node-modules/sendmessage.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/node-modules/sendmessage?branch=master\n[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat-square\n[gittip-url]: https://www.gittip.com/fengmk2/\n[david-image]: https://img.shields.io/david/node-modules/sendmessage.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/sendmessage\n[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/sendmessage.svg?style=flat-square\n[download-url]: https://npmjs.org/package/sendmessage\n\nSend a cross process message if message channel is connected.\nAvoid [channel closed](https://github.com/joyent/node/blob/cfcb1de130867197cbc9c6012b7e84e08e53d032/lib/child_process.js#L411) error throw out.\n\n## Install\n\n```bash\n$ npm install sendmessage --save\n```\n\n## Usage\n\n### master.js\n\n```js\nvar childprocess = require('child_process');\nvar sendmessage = require('sendmessage');\n\nvar worker = childprocess.fork('./worker.js');\nsendmessage(worker, {hi: 'this is a message to worker'});\n```\n\n### worker.js\n\n```js\nvar sendmessage = require('sendmessage');\n\nsendmessage(process, {hello: 'this is a message to master'});\n```\n\n## API\n\n### #sendmessage(childprocess, message);\n\nSend a cross process message.\nIf a process is not child process, this will just call `process.emit('message', message)` instead.\n\n- childprocess: child process instance\n- message: the message need to send\n\n```js\nsendmessage(process, {hello: 'this is a message to master'});\n```\n\nYou can switch to `process.emit('message', message)` using `process.env.SENDMESSAGE_ONE_PROCESS`\n\n## Test\n\n```bash\n$ npm install\n$ npm test\n```\n\n### Coverage\n\n```bash\n$ npm test-cov\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014 - 2015 fengmk2 <fengmk2@gmail.com> and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/node-modules/sendmessage","bugs":{"url":"https://github.com/node-modules/sendmessage/issues","email":"fengmk2@gmail.com"},"license":"MIT"}