{"id":22061869,"url":"https://github.com/rocco-gossmann/go_http_hotreload","last_synced_at":"2026-05-19T04:04:00.722Z","repository":{"id":261767085,"uuid":"884771330","full_name":"Rocco-Gossmann/go_http_hotreload","owner":"Rocco-Gossmann","description":"a small package, that presses your Browsers `CMD+R` / `Ctrl+R` / `F5` Key for you when ever the connected server shuts down and comes back up again.","archived":false,"fork":false,"pushed_at":"2025-02-27T05:35:02.000Z","size":768,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v1.0.0","last_synced_at":"2025-02-27T06:40:45.709Z","etag":null,"topics":["autoreload","go","web-server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Rocco-Gossmann.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-07T11:08:32.000Z","updated_at":"2025-02-27T05:35:06.000Z","dependencies_parsed_at":"2024-11-08T10:42:50.062Z","dependency_job_id":"6d93738f-ee12-4070-bff5-8b18405912d6","html_url":"https://github.com/Rocco-Gossmann/go_http_hotreload","commit_stats":null,"previous_names":["rocco-gossmann/go_http_hotreload"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rocco-Gossmann%2Fgo_http_hotreload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rocco-Gossmann%2Fgo_http_hotreload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rocco-Gossmann%2Fgo_http_hotreload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rocco-Gossmann%2Fgo_http_hotreload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rocco-Gossmann","download_url":"https://codeload.github.com/Rocco-Gossmann/go_http_hotreload/tar.gz/refs/heads/v1.0.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245139412,"owners_count":20567175,"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":["autoreload","go","web-server"],"created_at":"2024-11-30T18:15:51.355Z","updated_at":"2026-05-19T04:03:55.669Z","avatar_url":"https://github.com/Rocco-Gossmann.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go - Hotreload\n\n\u003c!-- TOC --\u003e\n\n- [Go - Hotreload](#go---hotreload)\n    - [Requirements](#requirements)\n    - [Installation](#installation)\n    - [Usage](#usage)\n        - [ServerSide](#serverside)\n        - [ClientSide](#clientside)\n        - [Sending Messages to Server](#sending-messages-to-server)\n    - [How it works](#how-it-works)\n        - [On the Server](#on-the-server)\n        - [On the Client](#on-the-client)\n        - [Flow](#flow)\n\n\u003c!-- /TOC --\u003e\n\u003c!-- /TOC --\u003e\n\n\na small package, that presses your Browsers `CMD+R` / `Ctrl+R` / `F5` Key for you when ever the connected server shuts down and comes back up again.\n\n## Requirements\n- Go 1.22.2 or higher\n- the `golang.org/x/net package`\n\n## Installation\n```bash\ngo get github.com/rocco-gossmann/go_http_hotreload`\n```\n\n## Usage\n### ServerSide\n\n```go\nimport \"github.com/rocco-gossmann/go_http_hotreload\"\nimport \"http\"\n\nfunc main() {\n    mux := http.NewServeMux();\n\n    // Register the routes required for the Module\n    go_http_hotreload.AppendToServeMux(mux);\n\n    // ...\n    http.ListenAndServe(\"0.0.0.0:8888\", mux)\n}\n```\n\n### ClientSide\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\t\u003chead\u003e\n\t\t\u003cscript defer type=\"text/javascript\" src=\"/hotreload.js\" \u003e\u003c/script\u003e\n\t\u003c/head\u003e\n\t...\n\u003c/html\u003e\n```\n\n### Sending Messages to Server\n\nthe WebSocket, that this module creates, can also be used to send Messages to the Servers-StdOut.\n\nFor that you can call:\n```javascript\nHotreload.sendMsg(\"line 1\", \"line 2\" /* , ... */);\n```\nEach argument will result in one line send to StdOut.\n\n\n## How it works\n\n### On the Server\n\nIt adds 3 new Routes to your ServeMux.\n\n| Route                  | Description                                                                                                                         |\n|------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `GET /hotreload.js`    | which is used to load the required Javascript functions on the client                                                               |\n| `HEAD /__hotreload.sw` | To check if the Server has come up after it shut down                                                                               |\n| `GET /__hotreload.sw`  | To connect to the ServiceWorker, that will check when the Server shuts down \u003cbr /\u003e and receive message send via `Hotreload.sendMsg` |\n\n### On the Client\n\nIt uses a combination of the `Fetch`- and `ServiceWorker`-APIs to function.\n\n### Flow\n\n![Flow](./assets/go_http_hotreload_flow.png)\n\u003c!----\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocco-gossmann%2Fgo_http_hotreload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocco-gossmann%2Fgo_http_hotreload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocco-gossmann%2Fgo_http_hotreload/lists"}