{"_id":"@6river/loopback-component-changestreamer","_rev":"5-791147c5e506c8eb4e038f0350f12d47","name":"@6river/loopback-component-changestreamer","description":"Stream model changes by SSE","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@6river/loopback-component-changestreamer","version":"0.0.1","description":"Stream model changes by SSE","main":"dist/component.js","directories":{"test":"test"},"scripts":{"prepublish":"typings install && gulp","pretest":"gulp","e2e":"mocha --timeout 30000 e2e/**/*test.js","e2e:debug":"npm run test -- --debug-brk","test":"npm run e2e"},"repository":{"type":"git","url":"git+ssh://git@github.com/6riversystems/loopback-component-changestreamer.git"},"keywords":["loopback","sse","streamer"],"author":{"name":"Nick Chistyakove"},"license":"ISC","bugs":{"url":"https://github.com/6riversystems/loopback-component-changestreamer/issues"},"homepage":"https://github.com/6riversystems/loopback-component-changestreamer#readme","devDependencies":{"chai":"^3.5.0","eslint":"^3.9.1","eslint-config-defaults":"^9.0.0","gulp":"^3.9.1","gulp-typescript":"^3.1.2","loopback":"^2.36.0","loopback-boot":"^2.23.0","mocha":"^3.1.2","sinon":"^1.17.6","sinon-chai":"^2.8.0","supertest":"^2.0.1","typescript":"^2.0.7","typings":"^2.0.0","uuid":"^2.0.3"},"gitHead":"3f5ac2a9394816da82e0724347989bbe708775fd","_id":"@6river/loopback-component-changestreamer@0.0.1","_shasum":"ff0baab3af34bb70e3fdc883b8bc989b6ef8440a","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"6river","email":"nick@6river.com"},"dist":{"shasum":"ff0baab3af34bb70e3fdc883b8bc989b6ef8440a","tarball":"https://registry.npmjs.org/@6river/loopback-component-changestreamer/-/loopback-component-changestreamer-0.0.1.tgz","integrity":"sha512-gQ2x0hCLVENZARKkQgZBSTu75jhzMoizkUNltxhHGGB+r36lCSMaBnd29r0BrJSo4uoeuMHmXVZtTwfxm24LNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG3O1gG1hvSTj6YX+w6uH0DE/cvvrvLwFbcyL2PlwytqAiEApZwEC3F9zm1OmbRioM3YrxY1Hopj6y9W0FN9tgMt9as="}]},"maintainers":[{"name":"6river","email":"nick@6river.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/loopback-component-changestreamer-0.0.1.tgz_1478723379273_0.2896527787670493"}}},"readme":"# loopback-component-changestreamer\n\nThe component observes a number specified models and notifies about the changes by SSE.\n\nThe main difference with Loopback /change-stream channels is that this implementation creates only two observers (after save and after delete) per model and then streams the changes to keep-alive registered connections. In contrast Loopback creates two same observers for **each** connection.\n\n\n## Install and Setup\nInstall the company:\n  npm install --save @6river/loopback-component-changestreamer\n\n**Important**! Disable compression middleware in middleware.json files like this:\n\n  ```javascript\n  {\n    ...\n    \"compression\": {\n      \"enabled\":false\n  \t},\n  \t...\n  }\n  ```\n  \nAdd the following configuration to component-config.json:\n\n  ```javascript\n  {\n    ...\n    \"loopback-component-changestreamer\": {\n      \"mountPath\": \"/api/updates\",\n      \"reconnectTimeout\": 3000,\n      \"responseTimeout\": 120000,\n      \"models\": [\n        \"Foo\",\n        \"Bar\",\n        \"Baz\"        \n      ]\n    },\n    ...\n  }\n  ```\n  \nSee _e2e/_ directory as an example for how to make project configuration.\n\nThe configuration parameters:\n  * mountPath - base URL to subscribe for updates;\n  * reconnectTimeout - instruct Browser to reconnect after this timeout if connection is lost;\n  * responseTimeout - the response socket will be closed after this timeout;\n  * models - array of model names to observe.\n\nThe component configuration above adds 3 middleware rules:\n  * GET \"/api/updates\" to connect some SourceEvent listener;\n  * GET \"/api/updates/stat\" to see a statistics about number of current connections;\n  * DELETE \"/api/updates\" to close all registered connections.\n\nThe following snippet can be used on client side to connect:\n\n  ```javascript\n  var src = new EventSource('//<host>:<port>/api/updates');\n  src.addEventListener('message', function(message) {\n    ...    \n  });\n  ```\n  ","maintainers":[{"email":"swdev@6river.com","name":"6river-machine"}],"time":{"modified":"2022-06-12T14:11:54.664Z","created":"2016-11-09T20:29:39.854Z","0.0.1":"2016-11-09T20:29:39.854Z"},"homepage":"https://github.com/6riversystems/loopback-component-changestreamer#readme","keywords":["loopback","sse","streamer"],"repository":{"type":"git","url":"git+ssh://git@github.com/6riversystems/loopback-component-changestreamer.git"},"author":{"name":"Nick Chistyakove"},"bugs":{"url":"https://github.com/6riversystems/loopback-component-changestreamer/issues"},"license":"ISC","readmeFilename":"README.md"}