ERROR: the index 'mqtt' does not exist

I am getting the error 'ERROR: the index ‘mqtt’ does not exist`, while trying to implement a simple MQTT message sender.

Short (relevant) code here:

const MQTT_URL  = "ssl://mqtt.<domain>";
const MQTT_PORT = 8883
const MQTT_UN   = "electricimp";
const MQTT_PW   = "<pass>";
local mqtt_cid = "sensors/" + imp.configparams.deviceid;
local mqtt_client = null;
function createMqttClient() {
    // Instance an MQTT client
    mqtt_client = mqtt.createclient();
    
    // Connect with credentials
    local options = {};
    options.username <- MQTT_UN;
    options.password <- MQTT_PW;
    mqtt_client.connect(MQTT_URL + ":" + MQTT_PORT.tostring(), mqtt_cid, options);
}

function postReading(reading) {
    createMqttClient()
}
device.on("reading", postReading);

Full trace:
[Status] Downloading new code; 8.99% program storage used
[Agent] ERROR: the index ‘mqtt’ does not exist
[Agent] ERROR: in createMqttClient agent_code:103
[Agent] ERROR: from postReading agent_code:60

(line numbers are different from above, since it’s a snippet)

Any idea on how to get my imp to understand mqtt?

From mqtt | Dev Center

Note Electric Imp’s Azure IoT Hub MQTT integration is currently in public Beta. Before proceeding, please sign up for access to the Azure IoT Hub MQTT integration using this link. You should also use this link to register agent(s) for access to the MQTT API.

Have you signed up for access to the preview?

Thanks for the response!

I’m not interested in the Azure MQTT integration (which according to the documentation is a different library, if I’m reading that correctly), just in the basic/plain MQTT library (I have my own MQTT endpoint), which is documented here: https://developer.electricimp.com/api/mqtt

Isn’t that mqtt integration a basic library (just like device, imp, http, etc) on/for the imp?

No. It’s in preview status, so it’s disabled (via a feature flag) on the normal servers. You’ll need to sign up, so that we know which devices/groups to move to the preview server, even if you don’t want the full Azure integration.

Aaah, didn’t know that. I’ll try that - thanks!