Get topic messages
Methods
Method
Type
Description
Requirement
//Create the query
new TopicMessageQuery()
.setTopicId(newTopicId)
.subscribe(client, topicMessage -> {
System.out.println("at " + topicMessage.consensusTimestamp + " ( seq = " + topicMessage.sequenceNumber + " ) received topic message of " + topicMessage.contents.length + " bytes");
});
//v2.0.0//Create the query
new TopicMessageQuery()
.setTopicId(topicId)
.setStartTime(0)
.subscribe(
client,
(message) => console.log(Buffer.from(message.contents, "utf8").toString())
);
//v2.0.0//Create the query
_, err = hedera.NewTopicMessageQuery().
SetTopicID(topicID).
Subscribe(client, func(message hedera.TopicMessage) {
if string(message.Contents) == content {
wait = false
}
})
if err != nil {
panic(err)
}
//v2.0.0Last updated