bifromqio / bifromq

A Multi-Tenancy MQTT broker adopting Serverless architecture
https://bifromq.io
Apache License 2.0
614 stars 61 forks source link

Webhook: Call http endpoint for auth and on message publish #53

Closed delfme closed 5 months ago

delfme commented 7 months ago

Is your feature request related to a problem? Please describe. Hello, is there a way to configure the broker to forward the user credentials and the mqtt messages to an http endpoint via webhook?

Describe the solution you'd like We basically uses a Nodejs endpoint that authenticates user over JWT (broker sends to endpoint the username field onAuth svent) and also receives incoming mqtt messages' payload (onPublish) to take action accordingly.

Describe alternatives you've considered We currently use Vernemq broker to enjoy above feature, but would like to test bifromq if these features were available.

popduke commented 7 months ago

BifroMQ does not directly support webhooks; however, one can implement them using the plugin mechanism. In your scenario, the 'auth hook' could be achieved by using a customized auth provider plugin, which some of our users have actually done. As for the 'message hook', we recommend using a decoupled data integration approach. You can leverage the companion project 'bifromq-data-integration' as a starting point.