{"id":15434259,"url":"https://github.com/mpetrunic/fastify-sse-v2","last_synced_at":"2026-01-29T15:00:46.396Z","repository":{"id":38196714,"uuid":"253794486","full_name":"mpetrunic/fastify-sse-v2","owner":"mpetrunic","description":"Provide Server-Sent Events to Fastify","archived":false,"fork":false,"pushed_at":"2026-01-27T10:49:42.000Z","size":370,"stargazers_count":117,"open_issues_count":4,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-27T20:59:38.612Z","etag":null,"topics":["fastify","fastify-plugin","server-sent-events","sse","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpetrunic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-04-07T13:02:38.000Z","updated_at":"2026-01-27T10:50:23.000Z","dependencies_parsed_at":"2023-07-25T10:49:02.128Z","dependency_job_id":"f6211ae5-9c4c-43dd-adbe-07ecb0f95d7d","html_url":"https://github.com/mpetrunic/fastify-sse-v2","commit_stats":{"total_commits":99,"total_committers":14,"mean_commits":7.071428571428571,"dds":0.5656565656565656,"last_synced_commit":"83d69263137d3e85a2600295c6f7a67e5fd506b9"},"previous_names":["mpetrunic/fastify-sse-v2","nodefactoryio/fastify-sse-v2"],"tags_count":24,"template":false,"template_full_name":"ChainSafe/typescript-lib-template","purl":"pkg:github/mpetrunic/fastify-sse-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetrunic%2Ffastify-sse-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetrunic%2Ffastify-sse-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetrunic%2Ffastify-sse-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetrunic%2Ffastify-sse-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpetrunic","download_url":"https://codeload.github.com/mpetrunic/fastify-sse-v2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetrunic%2Ffastify-sse-v2/sbom","scorecard":{"id":662819,"data":{"date":"2025-08-11","repo":{"name":"github.com/mpetrunic/fastify-sse-v2","commit":"6b94014fde72f8c0e16841b466438e55666fdf87"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"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":"Code-Review","score":5,"reason":"Found 7/13 approved changesets -- score normalized to 5","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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/ci.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/ci.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/mpetrunic/fastify-sse-v2/pr.yaml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"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":10,"reason":"no dangerous workflow patterns detected","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Warn: no topLevel permission defined: .github/workflows/pr.yaml:1","Info: no jobLevel write permissions found"],"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 1 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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yaml:31"],"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":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-rrr8-f88r-h8q6","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 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-21T16:45:12.113Z","repository_id":38196714,"created_at":"2025-08-21T16:45:12.114Z","updated_at":"2025-08-21T16:45:12.114Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28880017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"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":["fastify","fastify-plugin","server-sent-events","sse","typescript"],"created_at":"2024-10-01T18:38:30.341Z","updated_at":"2026-01-29T15:00:46.350Z","avatar_url":"https://github.com/mpetrunic.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Fastify SSE Plugin\n\n![CI check](https://github.com/NodeFactoryIo/fastify-sse-v2/workflows/CI%20check/badge.svg?branch=master)\n[![npm version](https://badge.fury.io/js/fastify-sse-v2.svg)](https://badge.fury.io/js/fastify-sse-v2)\n\nFastify plugin for sending [Server-sent events](https://en.wikipedia.org/wiki/Server-sent_events).\n\nFor `fastify@2.x` use [fastify-sse-v2@1.x](https://github.com/NodeFactoryIo/fastify-sse-v2/tree/1.x)!\n\n### How to use?\n\n```terminal\nyarn add fastify-sse-v2\n```\n\nRegister fastify-sse-v2 plugin into your fastify instance:\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\n\nconst server = fastify();\nserver.register(FastifySSEPlugin);\n```\n\n#### Sending events from AsyncIterable source\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\n\nconst server = fastify();\nserver.register(FastifySSEPlugin);\n\nserver.get(\"/\", function (req, res) {\n  res.sse(\n    (async function* source() {\n      for (let i = 0; i \u003c 10; i++) {\n        sleep(2000);\n        yield { id: String(i), data: \"Some message\" };\n      }\n    })()\n  );\n});\n```\n\n#### Sending individual events\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\n\nconst server = fastify();\nserver.register(FastifySSEPlugin);\n\nserver.get(\"/\", async function (req, res) {\n  for (let i = 0; i \u003c 10; i++) {\n    await sleep(2000);\n    res.sse({ id: String(i), data: \"Some message\" });\n  }\n});\n\nfastify.get(\"/listenForChanges\", {}, (request, reply) =\u003e {\n  const listenStream = fastify.db\n    .watch(\"doc-uuid\")\n    .on(\"data\", (data) =\u003e reply.sse({ data: JSON.stringify(data) }))\n    .on(\"delete\", () =\u003e reply.sse({ event: \"close\" }));\n  request.socket.on(\"close\", () =\u003e listenStream.end());\n});\n```\n\n##### Note\n\n- When sending individual events, the connection is kept open until you call `reply.sseContext.source.end()` to terminate the stream.\n\n##### Sending events from EventEmmiters\n\n- [not supported in all nodejs versions](https://nodejs.org/api/events.html#events_events_on_emitter_eventname_options)\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\nimport { on } from \"events\";\n\nconst server = fastify();\nserver.register(FastifySSEPlugin);\n\nserver.get(\"/\", function (req, res) {\n  res.sse(\n    (async function* () {\n      for await (const [event] of on(eventEmmitter, \"update\")) {\n        yield {\n          event: event.name,\n          data: JSON.stringify(event),\n        };\n      }\n    })()\n  );\n});\n```\n\n##### Note\n\n- to remove event listeners (or some other cleanup) when client closes connection,\n  you can listen on connection closing event: `request.socket.on('close', () =\u003e abortController.abort());\n`\n\n##### Change server send retry behavior\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\n\nconst server = fastify();\n\nserver.register(FastifySSEPlugin) // retryDelay default 3000\n\nserver.register(FastifySSEPlugin, {\n  retryDelay: false // disable retryDelay\n  retryDelay: 5000 // override 5000\n})\n```\n\n##### Change default highWaterMark\n\n```javascript\nimport { FastifySSEPlugin } from \"fastify-sse-v2\";\n\nconst server = fastify();\n\nserver.register(FastifySSEPlugin) // highWaterMark defaults to 16384 bytes (16kb)\n\nserver.register(FastifySSEPlugin, {\n  highWaterMark: 1024 // override default setting of 16384 (16kb) with 1024 (1kb)\n})\n```\n\n##### Note\n\n- You can set parameter `retryDelay` to `false` to disable the default behavior of sending retry, or set parameter `retryDelay` to `milliseconds` override the default 3000 retry interval .\n- You can set parameter `highWaterMark` to define the buffer size (in bytes) that determines when the buffer is full and a 'flush' should be performed. Default is 16kb. (![Learn more](https://nodejs.org/en/learn/modules/backpressuring-in-streams#how-does-backpressure-resolve-these-issues))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetrunic%2Ffastify-sse-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpetrunic%2Ffastify-sse-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetrunic%2Ffastify-sse-v2/lists"}