Skip to content

A Golang utility that facilitates browser auto-refresh when the server is restarted

License

Notifications You must be signed in to change notification settings

lavigneer/browser-autorefresh

Repository files navigation

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

About

A Golang utility that facilitates browser auto-refresh when the server is restarted

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages