Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 998 Bytes

README.md

File metadata and controls

23 lines (14 loc) · 998 Bytes

Go Reference

browser-autorefresh

This is a small Golang utility that can be installed as part of a web server that facilitates browser page auto-refresh when the service is restarted via some live-relaod function

There are two components this utility provides:

  1. An http handler for a websocket endpoint
  2. A template that provides a JS script to include in a page's html that uses the websocket endpoint to detect when the server is operational.

When the websocket connection is lost, a retry on the client-side occurs until it is able to reconnect, at which point it reloads the page to pull in the latest changes.

This is most useful when combined with a server live reload tool (e.g., air).

Installation

go get github.com/lavigneer/browser-autorefresh

Example

See examples/std