{"_id":"json-streamer","_rev":"5-dc194b8e75e6019f7a45b7ad99ef5470","name":"json-streamer","description":"A really basic library for streaming JSON","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"json-streamer","description":"A really basic library for streaming JSON","version":"0.0.1","main":"index","dependencies":{},"devDependencies":{},"engine":"node >= 0.6.0","_npmUser":{"name":"dbrain","email":"npm@biboop.com"},"_id":"json-streamer@0.0.1","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.105","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"36ebc021ce41a024ad0ba469dcf166fb91153bc1","tarball":"https://registry.npmjs.org/json-streamer/-/json-streamer-0.0.1.tgz","integrity":"sha512-N3tBBRoEysJwmuEi3uSFv9oCWDAr5esa5SFd25oM2rA3neFKiHtBjNFn9FIgqNPMYtTLE3V3HIT/uw07r3uLnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHzmtHoxqsSkPfG8Ph1nCxN1rG+lGPzvTU3DufK6m4SxAiBcx2Y/YPmrPbuZF6KE6G2FNM3uAZ53we7756Tf1OS99A=="}]},"maintainers":[{"name":"dbrain","email":"npm@biboop.com"}]}},"readme":"# node-json-streamer\nA really basic library wrapping a node TCP socket sending and parsing multiple JSON objects.\nAll this does is add an escape character on the client side (\\u2603: A unicode snowman), split up the messages received on ]\\u2603 || }\\u2603, then emit 'msg' with the parsed JSON or nothing at all if it failed.\nIt does some error checking so if you send fluff down the socket then proper JSON it'll trim the fluff (without any kind of notification at all).\nOh it'll also randomly purge the buffer if it hits 512kb without any valid JSON. You know, just FYI.\n\n## Installation\n    $ npm link path/to/json-streamer\n    $ npm install json-streamer\n\n## Requirements\n- A recent version of node. package.json says v0.6.0 but I'm sure it can handle less than that.\n- Willingness to accept cuddles.\n\n## Features\n- Send and receive JSON reusing the same TCP connection\n- Error correction, if you send fluff then valid JSON it will recover (by deleting the fluff)\n\n## Example\n\n```javascript\nvar jsonStreamer = require('jsonStreamer');\n\nvar server = jsonStreamer.listen(3001);\n\nserver.on('connection', function (client) {\n  client.on('msg', function gotMsg(msg) {\n    console.log('Server received message: ', msg.content);\n    client.writeJSON({ ok: true });\n  })\n});\n\nvar client = jsonStreamer.connect(3001, function connectListener() {\n  console.log(\"Connected\");\n  client.writeJSON({ a: 'b', c: 'd'});\n  client.writeJSON(JSON.stringify({ b: 'b', d: 'd'}));\n  client.writeJSON(\"BAHABABAHBAHABHA\" + JSON.stringify({a: 'ok'}));\n  client.writeJSON(\"OH GOD WHY\");\n  client.writeJSON('{\"a\":\"b\"}');\n  client.writeJSON('{\"a\":');\n  client.writeJSON('\"b\"}');\n});\n\nclient.on('msg', function gotMsg(msg) {\n  console.log('Client received message: ', msg.content);\n});\n```\n","maintainers":[{"name":"dbrain","email":"npm@biboop.com"}],"time":{"modified":"2022-06-19T06:27:15.685Z","created":"2011-11-21T07:06:52.312Z","0.0.1":"2011-11-21T07:07:01.168Z"}}