{"id":15321567,"url":"https://github.com/dipeshdulal/sse-go","last_synced_at":"2025-10-07T18:44:26.591Z","repository":{"id":39052691,"uuid":"280616438","full_name":"dipeshdulal/sse-go","owner":"dipeshdulal","description":"Example using Server Sent Events in Go and React. ","archived":false,"fork":false,"pushed_at":"2024-01-09T17:51:44.000Z","size":4184,"stargazers_count":10,"open_issues_count":3,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T14:21:55.266Z","etag":null,"topics":["go","goroutine","react","serversentevents","streaming"],"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/dipeshdulal.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}},"created_at":"2020-07-18T08:38:49.000Z","updated_at":"2023-07-06T09:21:52.000Z","dependencies_parsed_at":"2023-02-06T00:31:42.140Z","dependency_job_id":null,"html_url":"https://github.com/dipeshdulal/sse-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fsse-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fsse-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fsse-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fsse-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipeshdulal","download_url":"https://codeload.github.com/dipeshdulal/sse-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248994984,"owners_count":21195478,"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":["go","goroutine","react","serversentevents","streaming"],"created_at":"2024-10-01T09:11:39.716Z","updated_at":"2025-10-07T18:44:21.552Z","avatar_url":"https://github.com/dipeshdulal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Server Sent Events using go.\n\n**Medium Article**: https://medium.com/wesionary-team/server-sent-events-with-go-and-react-76df101a3efe\n\nTo run server just run: (will run in `5000`  port)\n```\ngo run main.go\n```\n\nTo run frontend:\n```\nyarn install\nyarn start\n```\n\nThis will start frontend server in `3000` port. \n\nAfter running the frontend. You can send request to server or start or stop streaming by clicking in the button show below in screenshot.\n\n![Screenshot](sc.png)\n\n\n### What it does.\nClient sends the request to `/log` endpoint and every subscriber that is listening to the stream channel will receive message from server and frontend just displays the messages received from stream. \n\nYou can directly check streams going to `localhost:5000/sse` which will never finish responding to the events until client closes it. After opening the `/see` you can open another tab to `/log` and see that tab with `/sse` has output. Or, if you use curl you can just do.\n```\ncurl -X GET localhost:5000/log\ncurl -X POST -d \"MY DATA\" localhost:5000/log\n```\nAnd check how every request that is made to `log` endpoint is streamed to `sse` using ServerSideEvents.\n\n##### To Initialize SSE from JavaScript\n```js\nvar sse = new EventSource(\"http://localhost:5000/sse\")\nsse.onmessage = console.log \n```\n##### And to close the EventSource.\n```js\nsse.close()\n```\n\nTo learn more about SSE check the mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipeshdulal%2Fsse-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipeshdulal%2Fsse-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipeshdulal%2Fsse-go/lists"}