Skip to content

Commit

Permalink
feat(serve)!: implement live reloading with websockets
Browse files Browse the repository at this point in the history
- Added `tokio-tungstenite` and `futures-util` dependencies for websocket handling
- Implemented a websocket server that listens for connections and sends reload commands
- Injected a `livereload.js` script into HTML pages that establishes the websocket connection
- Changed the reload mechanism to trigger a websocket message instead of polling
- Updated the server to serve the `livereload.js` file

This replaces the hacky polling live reload mechanism with websockets for more efficient
and responsive updates. Closes #35
  • Loading branch information
NTBBloodbath committed Feb 5, 2025
1 parent 4fff9aa commit 9c2cebf
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 59 deletions.
86 changes: 83 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ notify = "8.0.0"
notify-debouncer-full = "0.5.0"
serde = { version = "1.0.217", features = ["derive"] }
mime_guess = "2.0.5"
tokio-tungstenite = "0.26.1"
futures-util = { version = "0.3.31", features = ["sink"] }

[dev-dependencies]
mockall = "0.13.1"
Expand Down
Loading

0 comments on commit 9c2cebf

Please sign in to comment.