{"id":15311124,"url":"https://github.com/talentlessguy/golang-reload-browser","last_synced_at":"2025-10-08T20:30:54.257Z","repository":{"id":57492039,"uuid":"204335999","full_name":"talentlessguy/golang-reload-browser","owner":"talentlessguy","description":"Browser reload with websockets in Go","archived":false,"fork":true,"pushed_at":"2019-12-14T20:54:10.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-02T08:31:46.605Z","etag":null,"topics":["browser-reload","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"markvincze/golang-reload-browser","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/talentlessguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-25T18:47:13.000Z","updated_at":"2022-12-03T21:46:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/talentlessguy/golang-reload-browser","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/talentlessguy%2Fgolang-reload-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talentlessguy%2Fgolang-reload-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talentlessguy%2Fgolang-reload-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talentlessguy%2Fgolang-reload-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/talentlessguy","download_url":"https://codeload.github.com/talentlessguy/golang-reload-browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235752085,"owners_count":19039837,"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":["browser-reload","go","golang"],"created_at":"2024-10-01T08:31:47.109Z","updated_at":"2025-10-08T20:30:48.947Z","avatar_url":"https://github.com/talentlessguy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang page reloader\n\n__I forked the repository to add go module and custom port.__\n\nThis is a small sample application implemented in Golang which can programmatically refresh a tab in a browser.\nIt is accompanying a blog post I've written about the subject with all the details: .\n\nIt hosts a small WebSocket service with a single `reload` endpoint, to which we can connect from the browser, and send a message every time we want it to be reloaded.\n\n## Install\n\n```sh\ngo get -u -v github.com/talentlessguy/golang-reload-browser\n```\n\nOpen a browser and press \"Enter\" in console.\n\n## Example\n\nGo code:\n\n```go\npackage main\n\nimport (\n\t\"bufio\"\n\t\"log\"\n\t\"os\"\n\trl \"talentlessguy/golang-reload-browser\"\n)\n\nfunc main() {\n\tlog.Println(\"Starting reload server.\")\n\n\trl.StartReloadServer(\":3000\")\n\n\tlog.Println(\"Reload server started.\")\n\tlog.Println(\"Press Enter to reload the browser!\")\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\treader.ReadString('\\n')\n\n\t\tlog.Println(\"Reloading browser.\")\n\t\trl.SendReload()\n\t}\n}\n```\n\nHTML page:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eReload test page\u003c/title\u003e\n    \u003cscript\u003e\n      const tryConnectToReload = address =\u003e {\n        const conn = new WebSocket(address)\n\n        conn.onclose = () =\u003e {\n          setTimeout(() =\u003e {\n            tryConnectToReload(address)\n          }, 2000)\n        }\n\n        conn.onmessage = evt =\u003e location.reload()\n      }\n      try {\n        if (window.WebSocket) {\n          // The reload endpoint is hosted on a statically defined port.\n          tryConnectToReload('ws://localhost:3000/reload')\n        } else {\n          console.log( 'Your browser does not support WebSockets :(')\n        }\n      } catch (e) {\n        console.error(`Exception during connecting to Reload: ${e}`)\n      }\n    \u003c/script\u003e\n  \u003c/head\u003e\n\u003c/html\u003e\n```\n\nThen run go file:\n\n```sh\ngo run main.go\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalentlessguy%2Fgolang-reload-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalentlessguy%2Fgolang-reload-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalentlessguy%2Fgolang-reload-browser/lists"}