weird-legacy icon indicating copy to clipboard operation
weird-legacy copied to clipboard

Auto-reload for preview window

Open krivahtoo opened this issue 1 year ago • 0 comments

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 a reload message via websoket.
  • Initializing a websoket connection then watching the content.json file for changes, sending a reload message on change.

Additional context

https://github.com/tiny-http/tiny-http/blob/master/examples/websockets.rs

krivahtoo avatar May 09 '23 07:05 krivahtoo