Mosquitto Interface for websockets. Html and /mqtt are published from the same interface
  • Shell 66.2%
  • Python 33.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Rich Hildred b61130b35a
All checks were successful
Build and Release CODESYS App / create-release (push) Successful in 3s
copy from my other server
2026-11-05 21:05:32 +00:00
.forgejo/workflows switch to python 2026-11-05 20:48:05 +00:00
debian_build copy from my other server 2026-11-05 21:05:32 +00:00
.gitignore finish this for testing 2026-11-05 16:02:37 +00:00
LICENSE add license and notice 2026-11-04 19:34:51 +00:00
NOTICE finish this for testing 2026-11-05 16:02:37 +00:00
README.md finish this for testing 2026-11-05 16:02:37 +00:00

websocket-mosquitto

to support an hmi

TLDR;

Coming in a couple of commits.

To get this to do https on a private ip

On a public ip address this uses the Caddy ask api to get a certificate that matches the hostname of the machine. Simply make an A and or AAAA record that points to the public ip and start it with the hostname of the machine that this package is being installed on.

This approach won't work with a private ip. If you need caddy to make a self signed certificate, or if you have a tailnet, you can use this approach:

:80 {
    # Redirect all unencrypted traffic to HTTPS
    redir https://{host}{uri}
}

:443 {
    # Provide the explicit paths to your Headscale/Tailscale certificates
    tls /etc/caddy/certs/appliance.crt /etc/caddy/certs/appliance.key

    # Serve your static frontend code securely
    root * /var/www/html
    file_server

    # Secure proxying for Mosquitto WebSockets (wss://)
    handle_path /mqtt {
        reverse_proxy localhost:9001
    }
}

I got the idea for this from an apache mod that I used back in the day. Turns out in 2026, it is much simpler. What I liked about the apache mod is that it got mosquitto in the same namespace as the web assets. One can do the ws(s) upgrade with a relative url. I preserved the history of the previous work as it was this relative url idea that I carried forward in 2026.