Callback Methods

On this page, you can find all client methods which are being triggered on specific actions and they all accept a callback function as the only argument.

OnConnection

client.OnConnection(cbk)

Provide a callback which will be executed when connecting to the web server.

OnChildrenCountChanged

client.OnChildrenCountChanged(cbk)

Not supported yet.

OnConnectionChanged

client.OnConnectionChanged(cbk)

Provide a callback which will be executed when the connection information changes.

OnConfigVersionChanged

client.OnConfigVersionChanged(cbk)

Not supported yet.

OnDataChanged

client.OnDataChanged(cbk)

Provide a callback which will be executed every time when data changes for all of the subscribed items.

Parameters

Name Type Description

cbk

function

A callback function

Examples

client = create_api_client() # see client.Connect() method


def on_data_changed(*args):
    _items = args[1]

    if isinstance(_items, list):
        for item in _items:
            item_val = item['v'] if 'v' in item else 'No Value'
            print("{} - {}".format(item['p'], item_val))

client.OnDataChanged(on_data_changed)

OnMessage

client.OnMessage(cbk)

Provide a callback which will executed when a new message is being received from the web server.

OnUserStateChanged

client.OnUserStateChanged(cbk)

Not supported yet.