{"id":13836178,"url":"https://github.com/lolo32/fastify-sse","last_synced_at":"2026-01-19T04:33:42.126Z","repository":{"id":24758344,"uuid":"102377920","full_name":"lolo32/fastify-sse","owner":"lolo32","description":"Provide Server-Sent Events to Fastify","archived":false,"fork":false,"pushed_at":"2025-11-16T13:08:15.000Z","size":71,"stargazers_count":20,"open_issues_count":39,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-16T15:09:36.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lolo32.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-09-04T15:51:40.000Z","updated_at":"2023-10-13T08:15:33.000Z","dependencies_parsed_at":"2024-04-12T11:01:53.014Z","dependency_job_id":"64a585d6-7d04-4b32-97b2-94a271dc8faf","html_url":"https://github.com/lolo32/fastify-sse","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.038461538461538436","last_synced_commit":"61936e505e8fa72ed625caf0aec0c049f8862b8d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lolo32/fastify-sse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lolo32%2Ffastify-sse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lolo32%2Ffastify-sse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lolo32%2Ffastify-sse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lolo32%2Ffastify-sse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lolo32","download_url":"https://codeload.github.com/lolo32/fastify-sse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lolo32%2Ffastify-sse/sbom","scorecard":{"id":597823,"data":{"date":"2025-08-11","repo":{"name":"github.com/lolo32/fastify-sse","commit":"61936e505e8fa72ed625caf0aec0c049f8862b8d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T23:36:41.933Z","repository_id":24758344,"created_at":"2025-08-20T23:36:41.933Z","updated_at":"2025-08-20T23:36:41.933Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28561842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T15:00:37.511Z","updated_at":"2026-01-19T04:33:42.111Z","avatar_url":"https://github.com/lolo32.png","language":"JavaScript","readme":"# fastify-sse\n\n[![Build Status](https://travis-ci.org/lolo32/fastify-sse.svg?branch=master)](https://travis-ci.org/lolo32/fastify-sse)\n[![Coverage Status](https://coveralls.io/repos/github/lolo32/fastify-sse/badge.svg)](https://coveralls.io/github/lolo32/fastify-sse)\n[![Known Vulnerabilities](https://snyk.io/test/github/lolo32/fastify-sse/badge.svg)](https://snyk.io/test/github/lolo32/fastify-sse)\n\nEasily send Server-Send-Events with Fastify.\n\n_This is based on [github.com/mtharrison/susie](https://github.com/mtharrison/susie)_\n\n## Install\n\n``\nnpm install --save fastify-sse\n``\n\n## Usage\n\nAdd it to you project with `register` and you are done!\n\nYou can now configure a new route, and call the new `reply.sse()` to send Events to browser.\n\nWhen you have finished sending event, you could send an empty message, or if using stream and end of stream, an\n`end` event will be fired just before closing the connection.  You could work with it browser side to prevent\nautomatic reconnection.\n\n```javascript\n// Register the plugin\nfastify.register(require(\"fastify-sse\"), (err) =\u003e {\n    if (err) {\n      throw err;\n    }\n});\n\n// Define a new route in hapijs notation\nfastify.route({\n  method: \"GET\",\n  url: \"/sse-hapi\",\n  handler: (request, reply) =\u003e {\n    let index;\n    const options = {};\n\n    // Send the first data\n    reply.sse(\"sample data\", options);\n    \n    // Send a new data every seconds for 10 seconds then close\n    const interval = setInterval(() =\u003e {\n      reply.sse({event: \"test\", data: index});\n      if (!(index % 10)) {\n        reply.sse();\n        clearInterval(interval);\n      }\n    }, 1000);\n  }\n});\n\n// Define a new route in express notation\nfastify.get(\"/sse-express\",(request, reply) =\u003e {\n    let index;\n    const options = {};\n\n    // Send the first data\n    reply.sse(\"sample data\", options);\n    \n    // Send a new data every seconds for 10 seconds then close\n    const interval = setInterval(() =\u003e {\n      reply.sse({event: \"test\", data: index});\n      if (!(index % 10)) {\n        reply.sse();\n        clearInterval(interval);\n      }\n    }, 1000);\n  });\n```\n\nThe `options` are used only for the first call, subsequent ignore it.\n\nYou could specify:\n\n* `strings` that well be sent directly\n* `buffers` that will be converted beck to strings, utf8 encoded\n* `objects` that will be stringified with the use of `\"fast-safe-stringify\"`\n* `streams` that are readables, and could deals with objectMode or not\n\n## Options\n\n* `idGenerator`: generate the event id, defaulting to a number incrementing, from 1\n* `event`: can be a string for the event name, or a function to compute the event name\n\n### idGenerator\n\nIt must be a function that will be called with the event in parameter, and must return a string that will be the\n`id` of the SSE, or it could be `null` if no id is needed.\n\nUsing a function:\n\n```javascript\nreply.sse(\"message\", {\n  idGenerator: (event) =\u003e {\n    // Retrieve the event name using the key myIdentifiant or use the timestamp if not exists …\n    return event.myIdentifiant || (new Date()).getTime();\n  }\n});\n```\n\nIt will transmit:\n\n\u003e id: 1504624133267\n\u003e\n\u003e data: message\n\nDo not display `id`, so pass null:\n\n```javascript\nreply.sse(\"message\", {idGenerator: null});\n```\n\nIt will transmit:\n\n\u003e data: message\n\n### event\n\nIt could be:\n* a function, called with the event in parameter and return a string that will be used, or a string if the event\nname doest not change. The event will be retrieved by the browser using `.on(\"eventName\", […])`.\n* nothing if you do not want a name, and events could be retrieved in the browser with the generic\n`.on(\"message\", […])`.\n\n```javascript\nreply.sse({myEventName: \"myEvent\", hello: \"world\"}, {\n  event: (event) =\u003e {\n    // Retrieve the event name using the key myEventName …\n    const name = event.myEventName;\n    // … delete it from the object …\n    delete event.myEventName;\n    // then return the name\n    return name;\n  }\n});\n```\n\nIt will transmit:\n\n\u003e id: 1\n\u003e\n\u003e event: MyEvent\n\u003e\n\u003e data: {\"hello\":\"world\"}\n","funding_links":[],"categories":["\u003ch2 align=\"center\"\u003eAwesome Fastify\u003c/h2\u003e"],"sub_categories":["\u003ch2 align=\"center\"\u003eEcosystem\u003c/h2\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flolo32%2Ffastify-sse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flolo32%2Ffastify-sse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flolo32%2Ffastify-sse/lists"}