Search code examples
mqttmosquittomessagebroker

Multiple client id prefixes in Mosquitto Broker


Is it possible to configure more than one clientid prefix in mosquitto.conf?

The property name is in plural form "clientid_prefixes" but it doesn't work if I use spaces, comma or semicolon as separator.


Solution

  • Looking at the source code for the test for this feature it looks like it can only be a single value.

    /* clientid_prefixes check */
    if(db->config->clientid_prefixes){
        if(strncmp(db->config->clientid_prefixes, client_id, strlen(db->config->clientid_prefixes))){
            send__connack(context, 0, CONNACK_REFUSED_NOT_AUTHORIZED);
            rc = 1;
            goto handle_connect_error;
        }
    }