{"_id":"udp-request","_rev":"239759","name":"udp-request","description":"Small module for making requests/responses over UDP","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2023-03-24T16:57:32.000Z","created":"2016-09-21T12:10:15.881Z","2.0.0":"2018-09-18T23:45:30.353Z","1.5.0":"2017-12-02T18:56:19.537Z","1.4.0":"2016-10-26T18:39:02.526Z","1.3.1":"2016-10-26T16:30:54.332Z","1.3.0":"2016-10-25T14:55:45.408Z","1.2.0":"2016-10-25T11:24:14.382Z","1.1.2":"2016-10-01T18:20:39.126Z","1.1.1":"2016-09-23T13:37:19.546Z","1.1.0":"2016-09-22T12:33:03.662Z","1.0.1":"2016-09-21T13:08:41.316Z","1.0.0":"2016-09-21T12:10:15.881Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"versions":{"2.0.0":{"name":"udp-request","version":"2.0.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^12.0.1","tape":"^4.9.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"78ebc1d67bcc7dc8e8d5d8e724d260fd8e9bb8d6","_id":"udp-request@2.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"809cbd3cedb12e88ecaa56e89660d7e4d1838185","size":4029,"noattachment":false,"key":"/udp-request/-/udp-request-2.0.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-2.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/udp-request_2.0.0_1537314330261_0.7376458963706833"},"_hasShrinkwrap":false,"publish_time":1537314330353,"_cnpm_publish_time":1537314330353,"_cnpmcore_publish_time":"2021-12-16T23:53:04.598Z"},"1.5.0":{"name":"udp-request","version":"1.5.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"07503583c401abc5bd4750ecc96c318801de9ea5","_id":"udp-request@1.5.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"98f6c22d1f445ce7e4b64c7619f16bc23705a0c2","size":4106,"noattachment":false,"key":"/udp-request/-/udp-request-1.5.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.5.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/udp-request-1.5.0.tgz_1512240979424_0.16860452597029507"},"directories":{},"publish_time":1512240979537,"_hasShrinkwrap":false,"_cnpm_publish_time":1512240979537,"_cnpmcore_publish_time":"2021-12-16T23:53:04.824Z"},"1.4.0":{"name":"udp-request","version":"1.4.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"18430cc54ee86df196ca9cd51f8a830040de8739","_id":"udp-request@1.4.0","_shasum":"b878d7bc6bb135d3cdfb39a46c7e231f943dd34d","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"b878d7bc6bb135d3cdfb39a46c7e231f943dd34d","size":4147,"noattachment":false,"key":"/udp-request/-/udp-request-1.4.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.4.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/udp-request-1.4.0.tgz_1477507140318_0.3854451607912779"},"directories":{},"publish_time":1477507142526,"_hasShrinkwrap":false,"_cnpm_publish_time":1477507142526,"_cnpmcore_publish_time":"2021-12-16T23:53:05.029Z"},"1.3.1":{"name":"udp-request","version":"1.3.1","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"db61560601a312a95b55a5eb8a52549a91b1807d","_id":"udp-request@1.3.1","_shasum":"16cc3792a49dbc8edee16a470ab654dca8b7524c","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"16cc3792a49dbc8edee16a470ab654dca8b7524c","size":4110,"noattachment":false,"key":"/udp-request/-/udp-request-1.3.1.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.3.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/udp-request-1.3.1.tgz_1477499452042_0.4440304869785905"},"directories":{},"publish_time":1477499454332,"_hasShrinkwrap":false,"_cnpm_publish_time":1477499454332,"_cnpmcore_publish_time":"2021-12-16T23:53:05.250Z"},"1.3.0":{"name":"udp-request","version":"1.3.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"2945d59bef7371e2bdeabccb3a6618c97fcf479c","_id":"udp-request@1.3.0","_shasum":"bacdd3e57f1402f9fda144407f66902a1ae45b61","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"bacdd3e57f1402f9fda144407f66902a1ae45b61","size":4113,"noattachment":false,"key":"/udp-request/-/udp-request-1.3.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.3.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/udp-request-1.3.0.tgz_1477407343181_0.33505248418077826"},"directories":{},"publish_time":1477407345408,"_hasShrinkwrap":false,"_cnpm_publish_time":1477407345408,"_cnpmcore_publish_time":"2021-12-16T23:53:05.457Z"},"1.2.0":{"name":"udp-request","version":"1.2.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"a136c4aee569e293493a7e381ecd18a70d064667","_id":"udp-request@1.2.0","_shasum":"eb7e8f0808c7a770bca1928ef121785a0a1c3285","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"eb7e8f0808c7a770bca1928ef121785a0a1c3285","size":4096,"noattachment":false,"key":"/udp-request/-/udp-request-1.2.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/udp-request-1.2.0.tgz_1477394652309_0.9989165689330548"},"directories":{},"publish_time":1477394654382,"_hasShrinkwrap":false,"_cnpm_publish_time":1477394654382,"_cnpmcore_publish_time":"2021-12-16T23:53:05.639Z"},"1.1.2":{"name":"udp-request","version":"1.1.2","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"25710c62445536d130dd85e76d2cb685be90202f","_id":"udp-request@1.1.2","_shasum":"b2ff829fad3805f3734e9f2fc68be7efd9880dbe","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"b2ff829fad3805f3734e9f2fc68be7efd9880dbe","size":4082,"noattachment":false,"key":"/udp-request/-/udp-request-1.1.2.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.1.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/udp-request-1.1.2.tgz_1475346037545_0.6642272942699492"},"directories":{},"publish_time":1475346039126,"_hasShrinkwrap":false,"_cnpm_publish_time":1475346039126,"_cnpmcore_publish_time":"2021-12-16T23:53:05.823Z"},"1.1.1":{"name":"udp-request","version":"1.1.1","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"312ec22abb9807224b09390e81e116ec6636ab88","_id":"udp-request@1.1.1","_shasum":"f13a49f3ccb612bcb314934c09c2ad46d4a6f063","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"f13a49f3ccb612bcb314934c09c2ad46d4a6f063","size":4078,"noattachment":false,"key":"/udp-request/-/udp-request-1.1.1.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.1.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/udp-request-1.1.1.tgz_1474637838511_0.6328057427890599"},"directories":{},"publish_time":1474637839546,"_hasShrinkwrap":false,"_cnpm_publish_time":1474637839546,"_cnpmcore_publish_time":"2021-12-16T23:53:06.036Z"},"1.1.0":{"name":"udp-request","version":"1.1.0","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3","passthrough-encoding":"^1.2.0"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"87e77d8ea7a0fb903d404dc2051f202344379b49","_id":"udp-request@1.1.0","_shasum":"46fd595b9f10000fbdf485f66bf63ff994064479","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"46fd595b9f10000fbdf485f66bf63ff994064479","size":4045,"noattachment":false,"key":"/udp-request/-/udp-request-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/udp-request-1.1.0.tgz_1474547582942_0.2604897196870297"},"directories":{},"publish_time":1474547583662,"_hasShrinkwrap":false,"_cnpm_publish_time":1474547583662,"_cnpmcore_publish_time":"2021-12-16T23:53:06.232Z"},"1.0.1":{"name":"udp-request","version":"1.0.1","description":"Small module for making requests/responses over UDP","main":"index.js","dependencies":{"inherits":"^2.0.3"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"9e9d73f142eadcc24ea3aca80a65b0e7d4d2dec9","_id":"udp-request@1.0.1","_shasum":"67e8db8aaffdc1b30507c7ec40d9b08ff32b2b04","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"67e8db8aaffdc1b30507c7ec40d9b08ff32b2b04","size":3770,"noattachment":false,"key":"/udp-request/-/udp-request-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/udp-request-1.0.1.tgz_1474463318931_0.49583437759429216"},"directories":{},"publish_time":1474463321316,"_hasShrinkwrap":false,"_cnpm_publish_time":1474463321316,"_cnpmcore_publish_time":"2021-12-16T23:53:06.468Z"},"1.0.0":{"name":"udp-request","version":"1.0.0","description":"WIP - nothing to see here","main":"index.js","dependencies":{"inherits":"^2.0.3"},"devDependencies":{"standard":"^8.1.0","tape":"^4.6.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/udp-request.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"homepage":"https://github.com/mafintosh/udp-request","gitHead":"c16e3d5a09799019c474ef3f75a3aca7902ee038","_id":"udp-request@1.0.0","_shasum":"45a2e954a2ee718983b0ad97343870464859ad52","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"45a2e954a2ee718983b0ad97343870464859ad52","size":3783,"noattachment":false,"key":"/udp-request/-/udp-request-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/udp-request/download/udp-request-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/udp-request-1.0.0.tgz_1474459813911_0.21431167772971094"},"directories":{},"publish_time":1474459815881,"_hasShrinkwrap":false,"_cnpm_publish_time":1474459815881,"_cnpmcore_publish_time":"2021-12-16T23:53:06.681Z"}},"readme":"# udp-request\n\nSmall module for making requests/responses over UDP\n\n```\nnpm install udp-request\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/udp-request.svg?style=flat)](http://travis-ci.org/mafintosh/udp-request)\n\n## Usage\n\n``` js\nvar udp = require('udp-request')\nvar socket = udp()\n\nsocket.on('request', function (request, peer) {\n  console.log('request:', request.toString())\n  socket.response('echo: ' + request.toString(), peer)\n})\n\nsocket.listen(10000, function () {\n  socket.request('hello', {port: 10000, host: '127.0.0.1'}, function (err, response) {\n    console.log('response', response.toString())\n    socket.destroy()\n  })\n})\n```\n\n## API\n\n#### `var socket = udp([options])`\n\nCreate a new request/response udp socket. Options include:\n\n``` js\n{\n  timeout: 1000, // request timeout\n  socket: udpSocket, // supply your own udp socket\n  retry: true, // retry requests if they time out. defaults to false\n  requestEncoding: someEncoder, // abstract-encoding compliant encoder\n  responseEncoding: someEncoder, // abstract-encoding compliant encoder\n}\n```\n\n#### `var id = socket.request(buffer, peer, [options], [callback])`\n\nSend a new request. `buffer` is the request payload and `peer` should be an object containing `{port, host}`.\nWhen the response arrives (or the request times out) the callback is called with the following arguments\n\n``` js\ncallback(error, response, peer)\n```\n\nOptions include:\n\n``` js\n{\n  retry: true\n}\n```\n\n#### `socket.response(buffer, peer)`\n\nSend a response back to a request.\n\n#### `socket.cancel(id)`\n\nCancels a pending request.\n\n#### `socket.on('request', buffer, peer)`\n\nEmitted when a new request arrives. Call the above `.response` with the same peer object to send a response back to this request.\n\n#### `socket.on('response', buffer, peer)`\n\nEmitted when any response arrives.\n\n#### `socket.on('error', err)`\n\nEmitted when a critical error happens.\n\n#### `socket.on('warning', err)`\n\nEmitted when a non critical error happens (you usually do not need to listen for this).\n\n#### `socket.on('close')`\n\nEmitted when the request socket closes (after it is destroyed).\n\n#### `socket.on('listening')`\n\nEmitted when the socket is listening.\n\n#### `socket.listen([port], [callback])`\n\nListen on a specific port. If port is omitted a random one will be used.\n\n#### `socket.destroy()`\n\nCompletely destroy the request socket (cancels all pending requests).\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/udp-request","bugs":{"url":"https://github.com/mafintosh/udp-request/issues"},"license":"MIT"}