The broker control API gives information about listeners and plugins using
the listListeners
or listPlugins
command.
A broker API request can be published to $CONTROL/broker/v1
and the related
response message will be published to $CONTROL/broker/v1/response
.
To enable this API add enable_control_api true
to your mosquitto.conf.
Accepts the following message:
{
"commands": [
{
"command": "listListeners",
"correlationData": "716cc776-d044-4772-b991-d9b55e2e034c"
}
]
}
{
"commands": [
{
"command": "listPlugins",
"correlationData": "716cc776-d044-4772-b991-d9b55e2e034c"
}
]
}
Accepts the following message:
{
"responses": [
{
"command": "listListeners",
"data": {
"listeners": [
{
"id": 1,
"port": 1883,
"protocol": "mqtt",
"tls": false
},
{
"id": 2,
"port": 8883,
"protocol": "mqtt",
"tls": true,
"require-certificate": true
},
{
"id": 3,
"port": 8090,
"protocol": "mqtt+websockets",
"tls": true,
"require-certificate": true
}
]
},
"correlationData": "716cc776-d044-4772-b991-d9b55e2e034c"
}
]
}
{
"responses": [
{
"command": "listPlugins",
"data": {
"plugins": [
{
"name": "dynamic-security",
"control-endpoints": [
"$CONTROL/dynamic-security/v1"
]
},
{
"name": "inspect",
"version": "1.0",
"control-endpoints": [
"$CONTROL/cedalo/inspect/v1"
]
},
{
"name": "client-control",
"control-endpoints": [
"$CONTROL/cedalo/client-control/v1"
]
},
{
"name": "certificate-management",
"control-endpoints": [
"$CONTROL/certificate-management/v1"
]
}
]
},
"correlationData": "716cc776-d044-4772-b991-d9b55e2e034c"
}
]
}
Example of an error response message.
{
"responses": [
{
"command": "listListeners",
"error": "Error message",
"correlationData": "716cc776-d044-4772-b991-d9b55e2e034c"
}
]
}
This is an optional value to be able to identify the relation between request and response. The plugin will add the provided value in the response message.