https://github.com/furui/http-mqtt-bridge
https://github.com/furui/http-mqtt-bridge
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/furui/http-mqtt-bridge
- Owner: furui
- Created: 2026-06-22T09:42:20.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-06-22T10:51:19.000Z (about 1 month ago)
- Last Synced: 2026-06-22T11:23:16.590Z (about 1 month ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP to MQTT Bridge
A minimal HTTP to MQTT bridge written in Go that allows publishing MQTT messages via HTTP GET or POST requests.
## Environment Variables
| Variable | Required | Default | Description |
| :--- | :---: | :---: | :--- |
| `AUTH_KEY` | **Yes** | — | Secret token required to authorize requests. |
| `MQTT_HOST` | **Yes** | — | Broker connection URI (e.g., `tcp://localhost:1883`). |
| `MQTT_USER` | No | — | Username for broker authentication. |
| `MQTT_PASS` | No | — | Password for broker authentication. |
| `HTTP_PORT` | No | `8080` | Port for the HTTP server to listen on. |
---
## API Reference
### Endpoint
`ANY /publish`
### Parameters
Parameters must be passed as URL query variables (GET) or form-encoded body parameters (POST). Headers are ignored for authentication.
* `auth_key` (Required): Must match the application's `AUTH_KEY` environment variable.
* `topic` (Required): Target MQTT topic.
* `payload` (Required): String content to publish.
* `qos` (Optional): MQTT Quality of Service level (`0`, `1`, or `2`). Defaults to `1`.
---
## Examples
### HTTP GET
```bash
curl "http://localhost:8080/publish?auth_key=secret&topic=home/test&payload=hello&qos=0"