4.0.2 • Published 6 years ago

@mhlabs/aws-iot-ws-broker v4.0.2

Weekly downloads
1,656
License
ISC
Repository
github
Last release
6 years ago

aws-iot-mqtt-broker

Usage:

Installation

npm i @mhlabs/aws-iot-ws-broker

Connecting (TypeScript)

import AwsIot, { IotEvent } from '@mhlabs/aws-iot-ws-broker';

// credentials could be e.g. from Cognito Identity Pool
const creds: CognitoIdentityCredentials = createCredentials();
this.websocket = new AwsIot(creds, !environment.production);

Subscribe to topic:

New in this version is that subscribe() returns an Observable and therefor needs to be subscribed to. The Observable with emit and complete when the topic has been subscribed to.

this.websocket.subscribe('your/topic').subscribe(topic => console.log(`${topic} has been subscribed to`));

Send message

this.websocket.send('your/topic', message);

Handle message:

this.websocket.events.pipe(filter(event => event.type === IotEventType.Message)).subscribe(event => console.log(`Message on topic ${event.topic}:`, event.message));
4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.1.2

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.3.12

7 years ago

2.3.11

7 years ago

2.3.10

7 years ago

2.3.9

7 years ago

2.3.8

7 years ago

2.3.7

7 years ago

2.3.6

7 years ago

2.3.5

7 years ago

2.2.5

7 years ago

2.3.4

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.0.9

7 years ago

1.1.0

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago