Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed May 25, 2021
1 parent b1935f3 commit d70d692
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions bindings/nodejs/examples/10_mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ async function run() {
.node('https://api.hornet-0.testnet.chrysalis2.com')
.build();

client.subscriber().topics(['messages']).subscribe((err, data) => {
console.log(client.getMessageId(data.payload));
client.subscriber().topics(['milestones/confirmed', 'messages']).subscribe((err, data) => {
console.log(data);
// To get the message id `client.getMessageId(data.payload)` can be used
})

const message = await client.message()
.index('IOTA.RS BINDING - NODE.JS')
.data('some utf based data')
.submit();
console.log(message.message);
console.log(client.getMessageId(JSON.stringify(message.message)));
console.log(message);
}

run()

0 comments on commit d70d692

Please sign in to comment.