0.32.3 • Published 1 day ago

@aixpand/client v0.32.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

AiXpand Network TypeScript client

This package's purpose is to aid developers in interacting with the AiXpand Network.

In order to install the package, run the following command:

npm install --save @aixpand/client

Usage example:

import { AiXpandClient, AiXpandClientOptions, AiXpandEventType, AiXpandClientEvent } from '@aixpand/client';

const aixpOptions: AiXpandClientOptions = {
    mqtt: {
        protocol: 'mqtt',
        host: 'mqtt-host',
        port: 1883,
        username: 'username',
        password: 'password',
        session: {
            clean: true,
            clientId: null,
        },
    },
    name: 'client-internal-name',
    fleet: ['aixpand-node-name'],
    plugins: {},
};

const client = new AiXpandClient(aixpOptions);

client.boot();

// THIS IS AN EXAMPLE OF HOW TO INTERCEPT A SPECIFIC SYSTEM STREAM
client.getStream(AiXpandEventType.HEARTBEAT).subscribe((hearbeatData) => {
    console.log('-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
    console.log('Got heartbeat from: ', hearbeatData.sender.host);
    console.log('Known universe: ', client.getUniverse());
    console.log('-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
});

// Successfully upstream connection
client.on(AiXpandClientEvent.AIXP_CLIENT_CONNECTED, () => console.log('Connected!'));

// Boot callback
client.on(AiXpandClientEvent.AIXP_CLIENT_BOOTED, (err, status) => console.log('CLIENT SUCCESSFULLY BOOTED!'));

// Connected fleet callback
client.on(AiXpandClientEvent.AIXP_CLIENT_FLEET_CONNECTED, (status) => console.log(status));

// Broker topic subscription callback
client.on(AiXpandClientEvent.AIXP_CLIENT_SYS_TOPIC_SUBSCRIBE, (err, data) => {
    if (err) {
        console.error(err);

        return;
    }

    console.log(data);
});
0.32.3

1 day ago

0.32.2

28 days ago

0.32.1

1 month ago

0.32.0

2 months ago

0.31.5

2 months ago

0.31.4

2 months ago

0.31.3

2 months ago

0.31.1

2 months ago

0.30.3

2 months ago

0.31.0

2 months ago

0.30.2

4 months ago

0.30.1

5 months ago

0.30.0

5 months ago

0.29.6

5 months ago

0.29.5

5 months ago

0.29.4

5 months ago

0.29.0

5 months ago

0.29.3

5 months ago

0.29.2

5 months ago

0.29.1

5 months ago

0.28.7

5 months ago

0.28.6

5 months ago

0.28.5

5 months ago

0.27.7

6 months ago

0.28.1

6 months ago

0.28.0

6 months ago

0.28.4

5 months ago

0.28.3

5 months ago

0.28.2

5 months ago

0.27.2

6 months ago

0.27.1

6 months ago

0.27.0

6 months ago

0.27.6

6 months ago

0.27.5

6 months ago

0.27.4

6 months ago

0.27.3

6 months ago

0.26.2

6 months ago

0.26.1

6 months ago

0.26.0

6 months ago

0.19.0

8 months ago

0.15.4

9 months ago

0.13.6

9 months ago

0.19.1

8 months ago

0.13.7

9 months ago

0.13.8

9 months ago

0.13.9

9 months ago

0.13.0

9 months ago

0.13.1

9 months ago

0.15.0

9 months ago

0.13.2

9 months ago

0.11.4

9 months ago

0.15.1

9 months ago

0.13.3

9 months ago

0.17.0

8 months ago

0.15.2

9 months ago

0.13.4

9 months ago

0.15.3

9 months ago

0.13.5

9 months ago

0.23.4

7 months ago

0.25.1

7 months ago

0.23.3

7 months ago

0.21.5

7 months ago

0.25.0

7 months ago

0.23.2

7 months ago

0.21.4

7 months ago

0.23.1

7 months ago

0.21.3

7 months ago

0.23.0

7 months ago

0.21.2

8 months ago

0.21.1

8 months ago

0.16.3

8 months ago

0.14.5

9 months ago

0.12.0

9 months ago

0.12.1

9 months ago

0.14.0

9 months ago

0.14.1

9 months ago

0.16.0

9 months ago

0.14.2

9 months ago

0.16.1

9 months ago

0.14.3

9 months ago

0.18.0

8 months ago

0.16.2

9 months ago

0.14.4

9 months ago

0.22.1

7 months ago

0.22.0

7 months ago

0.20.2

8 months ago

0.11.3

11 months ago

0.11.0

11 months ago

0.10.1

11 months ago

0.11.1

11 months ago

0.10.2

11 months ago

0.11.2

11 months ago

0.9.2

12 months ago

0.9.1

12 months ago

0.9.0

12 months ago