Mdbook auto-update

Basic problem I want to solve: I want the mdbook serve experience, but I want to serve multiple books at the same time, and it's too cumbersome to start one mdbook process for each book. (Also, I'm running mdbook through a wrapper because I want to generate some extra metadata).

I'm working on several mdbooks in a project, and I'm linking the books to each other. I have a server which serves all the books at once, and I also have a tool which regenerates whatever book has been modified, much like mdbook serve does.

This works well, and I'm happy with it, but it could be even better -- if the web client could automatically reload the page once it has been regenerated, just like mdbook serve does. Anyone have the inside scoop on how the mechanics of automatically reloading the generated HTML in the web browser is implemented? Is it something that one could easily hook into with a different hosting solution? (Specifically Rocket instead of warp).

I think this post would be more appropriate for the users forum, this is for development of Rust itself.

It uses notify to detect when a file has changed and rebuilds the book. It then sends a message to a websocket. There is some javascript code which catches the message and reloads the page.

I'm not familiar with Rocket, so I can't comment on that. (I'm not too familiar with warp, either, but as you can see the code is very small.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.