{"_id":"3h-sse","_rev":"4-c08f316d37ac96c939b214b9228927f2","name":"3h-sse","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"3h-sse","version":"0.1.0","description":"A simple lib for server-sent events in NodeJS.","type":"commonjs","main":"dist/index.js","scripts":{"prebuild":"node -e \"fs.existsSync('dist') && fs.rmSync('dist', { recursive: true })\"","build":"tsc","test":"node ./test/index.cjs","docs":"dts2md \"**/*.d.ts\" \"!index.d.ts\" -i ./dist -o ./docs -l -I Home.md"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"keywords":["sse","server","sent","event","source","3h"],"author":{"name":"3h"},"license":"ISC","bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"homepage":"https://github.com/huang2002/3h-sse#readme","devDependencies":{"@types/node":"^20.5.9","3h-test":"^0.10.0","dts2md":"^0.4.4","typescript":"^5.2.2"},"_id":"3h-sse@0.1.0","gitHead":"2aa5ff40d82bbd586f5a12aaf5edb724d8bf3953","types":"./dist/index.d.ts","_nodeVersion":"18.17.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-2q8YqGkPhQEWyX2SYuhRq/hGEZuHabzEE0EGyDsUqImDZ+SwHXTPsrvc56UBYrcUqAusClVuKnyzmtxwuCZPWA==","shasum":"78b8a688b28954f8cc0024e74d8b27d957f2feb5","tarball":"https://registry.npmjs.org/3h-sse/-/3h-sse-0.1.0.tgz","fileCount":34,"unpackedSize":54312,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC2GEUfsaAZAkK2RX4bHmtdXsG2VbdU+UKnvDSKp+4ZrAiEAs+DttdGkkpvhRSdLsjXeDNed9yUTHtXE7amUovyQuNM="}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-sse_0.1.0_1696157067140_0.1760326539052013"},"_hasShrinkwrap":false},"0.2.0":{"name":"3h-sse","version":"0.2.0","description":"A simple lib for server-sent events in NodeJS.","type":"commonjs","main":"dist/index.js","scripts":{"prebuild":"node -e \"fs.existsSync('dist') && fs.rmSync('dist', { recursive: true })\"","build":"tsc","test":"node ./test/index.cjs","docs":"dts2md \"**/*.d.ts\" \"!index.d.ts\" -i ./dist -o ./docs -l -I Home.md"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"keywords":["sse","server","sent","event","source","3h"],"author":{"name":"3h"},"license":"ISC","bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"homepage":"https://github.com/huang2002/3h-sse#readme","devDependencies":{"@types/node":"^20.5.9","3h-test":"^0.10.0","dts2md":"^0.4.4","typescript":"^5.2.2"},"_id":"3h-sse@0.2.0","gitHead":"4f88444490ca1bbd8f3665b44ea0c97c771e034b","types":"./dist/index.d.ts","_nodeVersion":"18.17.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-Z2Nbm4UFKWvzbs+l51fgpD/z6hihfX4lStravZID2KMjfPbWVL9ckerHP2jbOv+Vpxixoy82Diai3jd9dPIEzw==","shasum":"513c50a7b8d30d58a0617dc663e6faf530548e69","tarball":"https://registry.npmjs.org/3h-sse/-/3h-sse-0.2.0.tgz","fileCount":34,"unpackedSize":54712,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUjME3XOXM5Y8KLAs49rVpbBKHbLAhY1JqSp7++EG9GgIhANfVeAeDt7wwcF5PL+dQjWxeTn0om8GArxM+XpHwnqPY"}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-sse_0.2.0_1696246897505_0.50468969250825"},"_hasShrinkwrap":false},"0.3.0":{"name":"3h-sse","version":"0.3.0","description":"A simple lib for server-sent events in NodeJS.","type":"commonjs","main":"dist/index.js","scripts":{"prebuild":"node -e \"fs.existsSync('dist') && fs.rmSync('dist', { recursive: true })\"","build":"tsc","test":"node ./test/index.cjs","docs":"dts2md \"**/*.d.ts\" \"!index.d.ts\" -i ./dist -o ./docs -l -I Home.md"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"keywords":["sse","server","sent","event","source","3h"],"author":{"name":"3h"},"license":"ISC","bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"homepage":"https://github.com/huang2002/3h-sse#readme","devDependencies":{"@types/node":"^20.5.9","3h-test":"^0.10.0","dts2md":"^0.4.4","typescript":"^5.2.2"},"_id":"3h-sse@0.3.0","gitHead":"41cec3135de32cb211b9e9eb4177177356d6c298","types":"./dist/index.d.ts","_nodeVersion":"18.17.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-5IX7dkOJKxvG5ERmo+BvTVQdcPM9AGxAVqesfJqsq8IvUy4E3oEf9YHgWUqsHyXKYi7w2Hir7jYfosN071P+sw==","shasum":"136a7fd9574a78438473c74cb050890ec2c954bd","tarball":"https://registry.npmjs.org/3h-sse/-/3h-sse-0.3.0.tgz","fileCount":34,"unpackedSize":55360,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDL43/0tGgWIetuN96Q7HaezSGBp1EkeaOK5Nup1eL5bAIhAKeu/eOBBG7DCQEdrc6xNddxvgULH88P8psG2WUatT/e"}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-sse_0.3.0_1696250318328_0.334775951666902"},"_hasShrinkwrap":false},"0.3.1":{"name":"3h-sse","version":"0.3.1","description":"A simple lib for server-sent events in NodeJS.","type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prebuild":"node -e \"fs.existsSync('dist') && fs.rmSync('dist', { recursive: true })\"","build":"tsc","test":"node ./test/index.cjs","docs":"dts2md \"**/*.d.ts\" \"!index.d.ts\" -i ./dist -o ./docs -l -I Home.md"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"keywords":["sse","server","sent","event","source","3h"],"author":{"name":"3h"},"license":"ISC","bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"homepage":"https://github.com/huang2002/3h-sse#readme","devDependencies":{"@types/node":"^20.5.9","3h-test":"^0.10.0","dts2md":"^0.4.4","typescript":"^5.2.2"},"_id":"3h-sse@0.3.1","gitHead":"589a392048e13a5415ad6ff6f898d3491eccfce7","_nodeVersion":"18.17.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-6C0W7rRpuS23bq2U+QoTBaOLTjR6yRw1F3NMxAQEFptiXKj3lGIh3bGwuPKgAY5syQ677bDKeBTRBZqtIYOVXQ==","shasum":"d484f41d82002d208fa436142d71ff890539adb2","tarball":"https://registry.npmjs.org/3h-sse/-/3h-sse-0.3.1.tgz","fileCount":33,"unpackedSize":55370,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOJX4lYoZLl/MqG1JXFD5c+hXTsSbeJmP5I5nYU1VetAIhAJ/QxdQ4EMWD52iFLtv7p6KsqycyItq7oZgYgKPMTRuS"}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-sse_0.3.1_1696340904666_0.9390543800038231"},"_hasShrinkwrap":false},"0.3.2":{"name":"3h-sse","version":"0.3.2","description":"A simple lib for server-sent events in NodeJS.","type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prebuild":"node -e \"fs.existsSync('dist') && fs.rmSync('dist', { recursive: true })\"","build":"tsc","test":"node ./test/index.cjs","docs":"dts2md \"**/*.d.ts\" \"!index.d.ts\" -i ./dist -o ./docs -l -I Home.md"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"keywords":["sse","server","sent","event","source","3h"],"author":{"name":"3h"},"license":"ISC","bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"homepage":"https://github.com/huang2002/3h-sse#readme","devDependencies":{"@types/node":"^20.5.9","3h-test":"^0.10.0","dts2md":"^0.4.4","typescript":"^5.2.2"},"_id":"3h-sse@0.3.2","gitHead":"7d4b63f7c238218f58a6d75a5e8a1defafc8b8d2","_nodeVersion":"18.17.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-XUBqULdBXDLEFg7iscph/8jmpOfCkXzQsp6Q9x0ZoZ696oagCvGNcyJMeRDICArlhFxE92QlrflDlo+c9e50oQ==","shasum":"783b46a857a3b7addc9d1f940f04f28745001cbb","tarball":"https://registry.npmjs.org/3h-sse/-/3h-sse-0.3.2.tgz","fileCount":15,"unpackedSize":20333,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAgffcqz8mYj0ICeqou1WVZV1du06jAVmxZGx2ehafHEAiEAuTvn4TwfuBJHRiXwQeBJuiFLS9QfrgePjKyOH8/HAXY="}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-sse_0.3.2_1696481334593_0.419213620678057"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-01T10:44:27.140Z","0.1.0":"2023-10-01T10:44:27.430Z","modified":"2023-10-05T04:48:54.943Z","0.2.0":"2023-10-02T11:41:37.681Z","0.3.0":"2023-10-02T12:38:38.609Z","0.3.1":"2023-10-03T13:48:24.802Z","0.3.2":"2023-10-05T04:48:54.762Z"},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"description":"A simple lib for server-sent events in NodeJS.","homepage":"https://github.com/huang2002/3h-sse#readme","keywords":["sse","server","sent","event","source","3h"],"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-sse.git"},"author":{"name":"3h"},"bugs":{"url":"https://github.com/huang2002/3h-sse/issues"},"license":"ISC","readme":"# 3h-sse\r\n\r\n> A simple lib for server-sent events in NodeJS.\r\n\r\n## Example\r\n\r\nHere's an example SSE server\r\nwhich emits an event periodically\r\nand sends a ping message every 10 seconds.\r\n\r\n```js\r\nconst http = require('http');\r\nconst SSE = require('3h-sse');\r\n\r\nconst backend = new SSE.NodeJSBackend();\r\nconst sseController = new SSE.SSEController({\r\n    backend,\r\n    pingInterval: 10_000,\r\n    pingText: ')',\r\n});\r\n\r\nconst server = http.createServer((req, res) => {\r\n    backend.addResponse(res);\r\n    res.once('close', () => {\r\n        backend.responses.delete(res);\r\n    });\r\n});\r\n\r\nsetInterval(() => {\r\n    sseController.sendEvent('name', 'data');\r\n}, 1000);\r\n\r\nsseController.start();\r\nserver.once('close', () => {\r\n    backend.clear();\r\n    sseController.stop();\r\n});\r\n```\r\n\r\n## Links\r\n\r\n- [API Reference](https://github.com/huang2002/3h-sse/wiki)\r\n- [Changelog](./CHANGELOG.md)\r\n- [License (ISC)](./LICENSE)\r\n","readmeFilename":"README.md"}