Skip to content

Subscription command

The subscription command allows you to get periodic updates for one or multiple values from the device, for example - monitor the microphone activity. Bundled activity subscription allows getting input and output channel audio activity data more efficiently, compared to querying each channel separately.

To subscribe to periodic updates the following command needs to be sent:

{
    "subscribe": [{
        "#": {
            "enable": true,
            "period_ms": 1000
        },
        "activity": [{
            "tx1": null,
            "tx2": null,
            "usb_in": null,
            "aux": null,
            "master": null,
            "rca": null,
            "usb_out": null,
            "xlr1": null,
            "xlr2": null,
            "dante1": null,
            "dante2": null
        }]
    }]
}

Let's break it down.

The values in the first attribute tell the device whether the subscription is enabled true or false and what frequency the data should be sent with - period_ms. As the attribute name implies the parameter should be the frequency described in milliseconds.

NB! The period_ms will accept values between 20 and 2^32 ms, however, you should not set the value below 40ms as there is a possibility of flooding the communication channel which will result in the device crashing.

The second, activity, attribute lists the parameters you wish to get updates for. Simply put, you will receive data about the listed values.

After calling the command you will get the initial response:

{
    "subscribe": [{
        "#": {
            "enable": true,
            "period_ms": 1000
        },
        "activity": [{
            "tx1": null,
            "tx2": null,
            "usb_in": null,
            "aux": null,
            "master": null,
            "rca": null,
            "usb_out": null,
            "xlr1": null,
            "xlr2": null,
            "dante1": null,
            "dante2": null
        }]
    }],
    "error": 0
}

This, as the rest of the commands, lets the client know that there were no errors when subscribing. The next message from the device will happen after the time set in the period_ms has elapsed and would be the following:

{
    "activity": [{
        "tx1": -100.00,
        "tx2": -100.00,
        "usb_in": -100.00,
        "aux": -91.53,
        "master": -97.53,
        "rca": -97.53,
        "usb_out": -97.53,
        "xlr1": -100.00,
        "xlr2": -100.00,
        "dante1": -100.00,
        "dante2": -100.00
    }],
    "error": 0
}

Note that only activity data and error parameters are returned.

When you no longer want the subscription data to be sent, you have to unsubscribe from the data stream. This can be done by setting the enabled flag to false in the initial command.

{
    "subscribe": [{
        "#": {
            "enable": false,
            "period_ms": 1000
        },
        "activity": [{
            "tx1": null,
            "tx2": null,
            "usb_in": null,
            "aux": null,
            "master": null,
            "rca": null,
            "usb_out": null,
            "xlr1": null,
            "xlr2": null,
            "dante1": null,
            "dante2": null
        }]
    }]
}