{"id":16395691,"url":"https://github.com/wallpants/remix-event-stream","last_synced_at":"2025-02-23T04:30:19.465Z","repository":{"id":240455106,"uuid":"802683050","full_name":"wallpants/remix-event-stream","owner":"wallpants","description":"Utilities for easier integration of server-sent events and remix","archived":false,"fork":false,"pushed_at":"2024-05-21T04:02:42.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-12T05:05:22.435Z","etag":null,"topics":["remix","server-sent-events"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/wallpants.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-05-19T01:08:13.000Z","updated_at":"2024-05-24T06:59:43.000Z","dependencies_parsed_at":"2024-05-21T05:22:07.956Z","dependency_job_id":null,"html_url":"https://github.com/wallpants/remix-event-stream","commit_stats":null,"previous_names":["wallpants/remix-event-stream"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallpants%2Fremix-event-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallpants%2Fremix-event-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallpants%2Fremix-event-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallpants%2Fremix-event-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wallpants","download_url":"https://codeload.github.com/wallpants/remix-event-stream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223823341,"owners_count":17208946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["remix","server-sent-events"],"created_at":"2024-10-11T05:05:24.348Z","updated_at":"2024-11-09T12:05:51.287Z","avatar_url":"https://github.com/wallpants.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# remix-event-stream\n\nUtilities for easier integration of [_server sent events_](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)\nwith [_remix_](https://remix.run/).\n\n1. Create a [Resource Route:](https://remix.run/docs/en/main/guides/resource-routes#creating-resource-routes)\n\n   ```ts\n   // app/routes/time.sse.ts\n   import { LoaderFunctionArgs } from \"@remix-run/node\";\n   import { EventStream } from \"remix-event-stream/server\";\n\n   // This loader returns an EventStream to allow for\n   // server-sent events. It sends the time every 5 seconds.\n\n   export function loader({ request }: LoaderFunctionArgs) {\n     return new EventStream(request, (send) =\u003e {\n       const timer = setInterval(() =\u003e {\n         send(new Date().toISOString());\n       }, 5_000);\n\n       return () =\u003e {\n         clearInterval(timer);\n       };\n     });\n   }\n   ```\n\n2. Receive data in React:\n\n   ```ts\n   // app/routes/time.tsx\n   import { useEventSource } from \"remix-event-stream/browser\";\n\n   export default function TimeRoute() {\n     const sseData = useEventSource({ url: \"/time.see\" });\n     return sseData;\n   }\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallpants%2Fremix-event-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwallpants%2Fremix-event-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallpants%2Fremix-event-stream/lists"}