Skip to content

Make server web page content auto-update when content file changes #123

@stelcodes

Description

@stelcodes

It would be awesome to have a truly hot-reloading web server that updates the web page when the associated content file is modified. I would have to change the ring app to be async I think and use http-kit's support for websockets. Then on the server I could poll the .lastModified time of the content file every second and upon a modification I could send an event to the client JS via WebSocket that contains the full HTML or possibly just the body element. Then the client JS could replace the body tag with the new one from the WebSocket.

I should probably just send a WebSocket message every second from the client to the server to make sure that it's still open. I don't think sending small messages every second would waste that many CPU cycles. I don't want to get into a state where the server is polling the file forever even though the WebSocket is closed. I think the server will have to poll both the file and the client JS.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions