{"_id":"udp-io","_rev":"43-f802883a0f553229a5cf22692e79b471","name":"udp-io","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.6":{"name":"udp-io","version":"1.0.6","author":{"name":"rany & ronena"},"license":"MIT","_id":"udp-io@1.0.6","maintainers":[{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"}],"dist":{"shasum":"980f0c408351cac3e1edce1597ba2f1ba46707b6","tarball":"https://registry.npmjs.org/udp-io/-/udp-io-1.0.6.tgz","integrity":"sha512-A9+WkLoAl9XDpHNlVP8eTuD88P/IyD0o5NQe1GT00HV/PqNt7/vbZmNsuzUrGZLigFaw4AOtAi+R7UIoKDzVrg==","signatures":[{"sig":"MEUCIHbsWoAbiAnIVUd9Nkn1P9qRT89C5oN2r68aWbJ56gwpAiEAjWPpw+NV9vhRXokVznWJbuLF3hn6aIwLpxguCCShWzU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./src/udp-io.js","_from":".","_shasum":"980f0c408351cac3e1edce1597ba2f1ba46707b6","gitHead":"b697e44c7331df0ad44a3b12f6d5ae8b16f66745","scripts":{"test":"gulp test"},"_npmUser":{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"},"_npmVersion":"3.8.9","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","directories":{},"_nodeVersion":"6.2.0","dependencies":{"node-uuid":"^1.4.7"},"devDependencies":{"gulp":"^3.9.1","jasmine":"^2.4.1","gulp-jasmine":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/udp-io-1.0.6.tgz_1468486746165_0.356349921785295","host":"packages-12-west.internal.npmjs.com"}},"1.0.7":{"name":"udp-io","version":"1.0.7","author":{"name":"rany & ronena"},"license":"MIT","_id":"udp-io@1.0.7","maintainers":[{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"}],"dist":{"shasum":"7ade5aac47b483d1e3f24bc7b35fe9a02840226a","tarball":"https://registry.npmjs.org/udp-io/-/udp-io-1.0.7.tgz","integrity":"sha512-2Qnh/KTw58E+lv2pVRDuJhvB5w/R5iMgw9yMPPe+WB196adsFzSeEQP9X6dbOWAc48RHnpz6/nMTEVHK8Wt+Ng==","signatures":[{"sig":"MEQCHzMbyCGUBF89NM+5GPHtWsgsai8GgZXJA59/+r9jTmECIQDP1PH+GOKiJmqlUPMd5mSgn3Lx0y7SF7fNDvO3u7Nl8A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./src/udp-io.js","_from":".","_shasum":"7ade5aac47b483d1e3f24bc7b35fe9a02840226a","gitHead":"a9188c9a59e064eb5b276466f623a1d693e4384a","scripts":{"test":"gulp test"},"_npmUser":{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"},"_npmVersion":"3.8.9","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","directories":{},"_nodeVersion":"6.2.0","dependencies":{"node-uuid":"^1.4.7"},"devDependencies":{"gulp":"^3.9.1","jasmine":"^2.4.1","gulp-jasmine":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/udp-io-1.0.7.tgz_1469545931883_0.35661221970804036","host":"packages-12-west.internal.npmjs.com"}},"1.0.8":{"name":"udp-io","version":"1.0.8","author":{"name":"rany & ronena"},"license":"MIT","_id":"udp-io@1.0.8","maintainers":[{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"}],"dist":{"shasum":"47f86d4568b7db5f22829e47ca57ac83b125a3ea","tarball":"https://registry.npmjs.org/udp-io/-/udp-io-1.0.8.tgz","integrity":"sha512-dPyl2yyA/BdVuXN5SJn3tjU3bE9fxpOhVjaLXvY/m1CFMaJrwvveQoAa0JKuPYQKtwOwI1izyviIpjTXHMQXFA==","signatures":[{"sig":"MEUCIQCA3Ng+Ny/f7e8sHMwSatZ4ITJ9kK4HNQzp7DFKuF+xZAIgG+ava1t3SRuUXXKePHKLp8jxOA4kcEXphdK0A89mNbw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./src/udp-io.js","_from":".","_shasum":"47f86d4568b7db5f22829e47ca57ac83b125a3ea","gitHead":"191894c6b30feaa999737c154375ec70041898ad","scripts":{"test":"gulp test"},"_npmUser":{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"},"_npmVersion":"3.8.9","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","directories":{},"_nodeVersion":"6.2.0","dependencies":{"node-uuid":"^1.4.7"},"devDependencies":{"gulp":"^3.9.1","jasmine":"^2.4.1","gulp-jasmine":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/udp-io-1.0.8.tgz_1469546274971_0.3891353972721845","host":"packages-16-east.internal.npmjs.com"}},"1.0.9":{"name":"udp-io","version":"1.0.9","author":{"name":"rany & ronena"},"license":"MIT","_id":"udp-io@1.0.9","maintainers":[{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"}],"dist":{"shasum":"8bdef2b183913935badba1ce5d5b53e6e24aa6dd","tarball":"https://registry.npmjs.org/udp-io/-/udp-io-1.0.9.tgz","integrity":"sha512-VfOreC1lgz5WROoOW8f0dX8KzwmHdJ0cNH0tLWnu2QPZZJzeqqBYG2WMDqdFXLvV6WqK+RGlz94HyTAgmyULRQ==","signatures":[{"sig":"MEYCIQCDSTARl45iagmCSiKnnai9f3Y6VjoVAT4KD0kl6InP6gIhAOD3rsysFJrCx+RiHgnUtB1FTO5aqY/xMwNrtgX/sz+A","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./src/udp-io.js","_from":".","_shasum":"8bdef2b183913935badba1ce5d5b53e6e24aa6dd","gitHead":"c4f9682cf612640ad9b1d34b2c2b11c93fe2daaa","scripts":{"test":"gulp test"},"_npmUser":{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"},"_npmVersion":"3.8.9","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","directories":{},"_nodeVersion":"6.2.0","dependencies":{"node-uuid":"^1.4.7"},"devDependencies":{"gulp":"^3.9.1","jasmine":"^2.4.1","gulp-jasmine":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/udp-io-1.0.9.tgz_1470062786581_0.5567523560021073","host":"packages-12-west.internal.npmjs.com"}},"1.1.0":{"name":"udp-io","version":"1.1.0","author":{"name":"rany & ronena"},"license":"MIT","_id":"udp-io@1.1.0","maintainers":[{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"}],"dist":{"shasum":"54719cca9e68f6d5b5642fc22c86bb3fda2ee5ab","tarball":"https://registry.npmjs.org/udp-io/-/udp-io-1.1.0.tgz","integrity":"sha512-DDOg7qBerwG49kZAgedLZQe91hMfUVF0ednxZ5Y69SWouAe/QMvimTZGl6bcSnxHkgSRlmY7nERxqxBvTpKJQg==","signatures":[{"sig":"MEUCIQCMYTERY8zupNVSEzSV+gs8u8gODKnbahLN0kqNrnb46AIgPlVVjXT9YniEqR7M7yrGF0htYUDWR5p6sjXWRoS38mo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./src/udp-io.js","_from":".","_shasum":"54719cca9e68f6d5b5642fc22c86bb3fda2ee5ab","gitHead":"386e863eb1fb066b6f53602ee12f7c9671f6b4b5","scripts":{"test":"gulp test"},"_npmUser":{"name":"ranyitzhaki","email":"ranyitzhaki@gmail.com"},"_npmVersion":"3.8.9","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","directories":{},"_nodeVersion":"6.2.0","dependencies":{"node-uuid":"^1.4.7"},"devDependencies":{"gulp":"^3.9.1","jasmine":"^2.4.1","gulp-jasmine":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/udp-io-1.1.0.tgz_1472135893894_0.9848248346243054","host":"packages-16-east.internal.npmjs.com"}}},"time":{"created":"2016-07-14T08:59:08.819Z","modified":"2026-09-29T13:55:04.071Z","1.0.6":"2016-07-14T08:59:08.819Z","1.0.7":"2016-07-26T15:12:13.950Z","1.0.8":"2016-07-26T15:17:57.222Z","1.0.9":"2016-08-01T14:46:28.255Z","1.1.0":"2016-08-25T14:38:16.828Z"},"author":{"name":"rany & ronena"},"license":"MIT","description":"> easy request response pattern for udp sockets, using nodejs dgram module.","maintainers":[{"email":"dev@bit.dev","name":"teambit-owner"},{"email":"shoham.gilad@gmail.com","name":"shohamgilad"},{"email":"davidnet@gmail.com","name":"davidfirst"},{"email":"me@ranmizrahi.com","name":"ranm8"},{"email":"guy@bit.dev","name":"guysaar"},{"email":"itay.mendelawy@gmail.com","name":"itaymendel"},{"email":"erez@bit.dev","name":"erezbit"},{"email":"yoshuakuttler@gmail.com","name":"joshk2"},{"email":"yona@bit.dev","name":"yona007"}],"readme":"# udp-io\n\n> easy request response pattern for udp sockets, using nodejs dgram module.\n\nA nicer interface to the built-in [`dgram`](http://nodejs.org/api/dgram.html) module.\n\n## Install\n\n```\n$ npm install --save udp-io\n```\n\n## Usage\nyou need to have two node servers, which every server opens a udp socket, define in the `bind` method. the two servers can be both \"client\" and \"server\" in the request resonse pattern.\n\non your \"server\" you need to define an event, you do this with the method `on`, with the name of the event and a function. you do whatever you want and then use the callback to send the payload back to request.\n\non the \"client\" you can use the method `send` with an event name, payload, port and host.\nthis method returns an es6 Promise with the result from the \"server\".\n\n## Example\n###### server\n```js\n//on the \"server\"\n\nconst udpIO = require('udp-io');\nconst udpSocket = require('dgram').createSocket('udp4');\nconst server = udpIO(udpSocket);\n\nserver.bind(33335);\n\nserver.on('MY_AWESOME_EVENT', (res, cb) => {\n  console.log(res.question);\n  cb({ answer: 'i\\'m fine, thanx !' });\n});\n```\n###### client\n```js\n//on the \"client\"\n\nconst udpIO = require('udp-io');\nconst udpSocket = require('dgram').createSocket('udp4');\nconst server = udpIO(udpSocket);\n\nserver.bind(33334);\nserver.setMaxTimeout(4000);\nserver.send('MY_AWESOME_EVENT', { question: 'how are you ?' }, 33335).then((res) => {\n  console.log(`answer: ${res.answer}`);\n});\n```\n\n## API\n\n#### server.bind(port, host)\n  binds the server to `port` and `host`, the host is default to localhost\n\n#### server.on(eventName, fn(req, cb))\n  register an event, `eventName` is a string and the function gets a request object and a callback, call the callback to send the message back.\n\n#### server.send(eventName, payload, port, host)\n  send an event to a certain host, returns an es6 Promise.\n  `eventName` is a string and `host` is default to localhost.\n\n#### server.setMaxTimeout(milliseconds)\n  change the max timeout for a request,\n  which after that the request expires.\n## License\nMIT\n","readmeFilename":"README.md"}