Replies: 2 comments
-
As an example from my use case, we want to basically drop a custom hook onto the server that leverages the Does that make sense? Happy to hear if I am trying to do things in a strange way if there is a cleaner alternative to this kind of pattern. |
Beta Was this translation helpful? Give feedback.
-
This is an interesting idea. In essence, we need to implement the ability to configure and run hooks which aren't in the original source compilation. In theory this is the problem that https://pkg.go.dev/plugin was supposed to solve, but I think we can all agree that's not the correct solution. As I see it, we need two implement two new features:
hooks:
- auth:
id: existing-auth
auth:
- username: peach
password: password1
allow: true
- username: melon
password: password2
allow: true
acl:
- remote: 127.0.0.1:*
- username: melon
filters:
melon/#: 3
updates/#: 2
- filters:
'#': 1
updates/#: 0
- debug:
id: debug-hook-id
showPacketData: true
- rpc:
id: rpc-hook-1
OnConnect: rpc-endpoint
OnConnectAuthenticate: rpc-endpoint
OnPublish: rpc-endpoint
|
Beta Was this translation helpful? Give feedback.
-
This is a placeholder ticket for future discussion about RPC based hooks. This comes from a discussion started here https://github.com/orgs/mochi-mqtt/discussions/281 where the desire to have the capability of utilizing the hosted Docker image and custom hooks outside of the standard ones that come included. This is explicitly for the usecase where the image is not wished to be built from source and instead the hosted image is used and configured with a file. Normally this functionality would be written and included essentially inside whatever hosts the
mqtt.Server
, but it currently seems that there is a desire to runMochi
as it comes.To do a bit of ideation, the first thing that comes to mind is that a user could have a separate container, server, or whatever where these hooks are hosted. A contract would be defined such that certain endpoints would be exposed which would provide the given functionality. Included in this contract would be things such max response time, payloads, etc. A "capabilities" endpoint would be exposed where the service provides how many unique modules there are, which hooks each use, and the routes to each.
Beta Was this translation helpful? Give feedback.
All reactions