{"id":15323752,"url":"https://github.com/mvrilo/eventsource","last_synced_at":"2025-10-09T10:31:33.792Z","repository":{"id":18753045,"uuid":"21965282","full_name":"mvrilo/eventsource","owner":"mvrilo","description":"Server-sent events for Go","archived":false,"fork":true,"pushed_at":"2014-07-18T03:26:25.000Z","size":139,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T19:02:13.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"antage/eventsource","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvrilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-18T02:44:11.000Z","updated_at":"2014-07-18T03:26:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mvrilo/eventsource","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mvrilo/eventsource","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Feventsource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Feventsource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Feventsource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Feventsource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvrilo","download_url":"https://codeload.github.com/mvrilo/eventsource/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Feventsource/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001275,"owners_count":26083040,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-01T09:21:38.398Z","updated_at":"2025-10-09T10:31:33.495Z","avatar_url":"https://github.com/mvrilo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eventsource\n\n_eventsource_ provides server-sent events for net/http server.\n\n## Usage\n\n### SSE with default options\n\n``` go\npackage main\n\nimport (\n    \"github.com/antage/eventsource\"\n    \"log\"\n    \"net/http\"\n    \"strconv\"\n    \"time\"\n)\n\nfunc main() {\n    es := eventsource.New(nil, nil)\n    defer es.Close()\n    http.Handle(\"/events\", es)\n    go func() {\n        id := 1\n        for {\n            es.SendEventMessage(\"tick\", \"tick-event\", strconv.Itoa(id))\n            id++\n            time.Sleep(2 * time.Second)\n        }\n    }()\n    log.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n```\n\n### SSE with custom options\n\n``` go\npackage main\n\nimport (\n    \"github.com/antage/eventsource\"\n    \"log\"\n    \"net/http\"\n    \"strconv\"\n    \"time\"\n)\n\nfunc main() {\n    es := eventsource.New(\n        \u0026eventsource.Settings{\n            Timeout: 5 * time.Second,\n            CloseOnTimeout: false,\n            IdleTimeout: 30 * time.Minute,\n        }, nil)\n    es.SendRetryMessage(3 * time.Second)\n    defer es.Close()\n    http.Handle(\"/events\", es)\n    go func() {\n        id := 1\n        for {\n            es.SendEventMessage(\"tick\", \"tick-event\", strconv.Itoa(id))\n            id++\n            time.Sleep(2 * time.Second)\n        }\n    }()\n    log.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n```\n\n### SSE with custom HTTP headers\n\n``` go\npackage main\n\nimport (\n    \"github.com/antage/eventsource\"\n    \"log\"\n    \"net/http\"\n    \"strconv\"\n    \"time\"\n)\n\nfunc main() {\n    es := eventsource.New(\n        eventsource.DefaultSettings(),\n        func(req *http.Request) [][]byte {\n            return [][]byte{\n                []byte(\"X-Accel-Buffering: no\"),\n                []byte(\"Access-Control-Allow-Origin: *\"),\n            }\n        },\n    )\n    defer es.Close()\n    http.Handle(\"/events\", es)\n    go func() {\n        id := 1\n        for {\n            es.SendEventMessage(\"tick\", \"tick-event\", strconv.Itoa(id))\n            id++\n            time.Sleep(2 * time.Second)\n        }\n    }()\n    log.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Feventsource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvrilo%2Feventsource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Feventsource/lists"}