O2 2.0
A communication protocol for interactive music and media applications.
Functions
MQTT API

Functions

O2err o2_mqtt_enable (const char *broker, int port_num)
 Enable MQTT to form wide-area-network connections between O2 processes. More...
 

Detailed Description

Function Documentation

◆ o2_mqtt_enable()

O2err o2_mqtt_enable ( const char *  broker,
int  port_num 
)

Enable MQTT to form wide-area-network connections between O2 processes.

Note that o2_mqtt_enable can be called before o2_initialize or while O2 initialization is waiting for a public IP port. In that case, O2_SUCCESS is called, but if O2 fails to obtain a public IP port (within about 10 seconds), an MQTT connection will not be established. This decision can be detected by calling o2_get_addresses (it will set the #public_ip parameter to "00000000" if there is no public IP).

Parameters
brokerAn IP address or name for an MQTT broker, or NULL or empty for default.
port_numA port number for the MQTT broker, or 0 for default.
Returns
O2_SUCCESS if successful, O2_NOT_INITIALIZED if O2 is not initialized, or O2_NO_NETWORK if networking is disabled (see o2_network_enable) or no Internet connection was found.