Skip to main content

subscribe-conflated-key

Including the basic AMPS library:

#include <amps/ampsplusplus.hpp>

Constructing the command:

AMPS::Command cmd(AMPS::Message::Command::Subscribe);

AMPS::Message::Options opts;
opts.setConflation("5s"); // Conflate at a 5 second interval
opts.setConflationKey("/id"); // Use the /id field to identify unique messages
// Set other options as needed

cmd.setTopic(topic).setOptions(opts);

The command can now be used in execute or executeAsync.