weird-legacy
weird-legacy copied to clipboard
Auto-reload for preview window
Problem
Currently, there is no auto-reload when the user generates the site, the user has to reload manually.
Solution
Auto-reload can be implemented using websocket which tiny-http supports (https://github.com/tiny-http/tiny-http/issues/8). This can be implemented with the following:
- Injecting a reload script into
index.html
. This script will reload the page when it receives areload
message via websoket. - Initializing a websoket connection then watching the
content.json
file for changes, sending areload
message on change.
Additional context
https://github.com/tiny-http/tiny-http/blob/master/examples/websockets.rs