You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Prometheus metrics example and documentation
- Introduced a new example for Prometheus metrics under `examples/metrics-prometheus`.
- Updated README and Chinese README to include Prometheus metrics in examples.
- Added new example documentation for Aedes Basic, Aedes WebSocket, AsyncAPI Standalone, AsyncAPI + Elysia, Lifecycle Events, Kafka Bridge, and Service Push.
- Enhanced handler limits documentation to reference the new metrics example.
- Updated metrics documentation to include runnable example instructions.
- Added new metrics to track dispatch duration, publish duration, in-flight handlers, and error phases.
Smallest possible mqttkit app: Aedes TCP broker, username-based auth, audit middleware, and a route that enforces `params.uid === principal.uid` on publish.
4
+
5
+
```bash
6
+
bun run --cwd examples/aedes-basic dev
7
+
```
8
+
9
+
Listens on `mqtt://localhost:1883`. Connect with any MQTT client.
10
+
11
+
## Source
12
+
13
+
<<< ../../examples/aedes-basic/src/index.ts
14
+
15
+
[View on GitHub](https://github.com/keyp-dev/mqttkit/tree/main/examples/aedes-basic)
Same as Aedes Basic but TCP is disabled and the broker listens on `ws://localhost:8888/mqtt`. Useful for browser-based MQTT clients (`mqtt.js` over WebSocket).
4
+
5
+
```bash
6
+
bun run --cwd examples/aedes-ws dev
7
+
```
8
+
9
+
## Source
10
+
11
+
<<< ../../examples/aedes-ws/src/index.ts
12
+
13
+
[View on GitHub](https://github.com/keyp-dev/mqttkit/tree/main/examples/aedes-ws)
Generates AsyncAPI 3.0 from registered routes and serves browsable docs on its own HTTP server. One TypeBox schema powers runtime validation, static `ctx.body` typing, and AsyncAPI payload at once.
Shares one `node:http` server between MQTT-over-WebSocket (handled by aedes) and an Elysia HTTP app that serves AsyncAPI docs. Useful when you don't want two separate ports.
4
+
5
+
```bash
6
+
bun run --cwd examples/asyncapi-elysia dev
7
+
```
8
+
9
+
Everything lives on `:3300` — MQTT WS on `/mqtt`, AsyncAPI HTTP routes alongside.
10
+
11
+
## Source
12
+
13
+
<<< ../../examples/asyncapi-elysia/src/index.ts
14
+
15
+
[View on GitHub](https://github.com/keyp-dev/mqttkit/tree/main/examples/asyncapi-elysia)
Demonstrates broker-level events: `client`, `clientReady`, `clientDisconnect`, `keepaliveTimeout`, `publish`, `subscribe`, etc. Each event is logged with `app.on(name, handler)` — handy for connection tracing and debugging.
4
+
5
+
```bash
6
+
bun run --cwd examples/events dev
7
+
```
8
+
9
+
Listens on `mqtt://localhost:1884` and `ws://localhost:8889/mqtt`.
10
+
11
+
## Source
12
+
13
+
<<< ../../examples/events/src/index.ts
14
+
15
+
[View on GitHub](https://github.com/keyp-dev/mqttkit/tree/main/examples/events) · [Events guide](../events)
0 commit comments