Skip to main content

subscribe-filter-replace

Including the basic AMPS library:

#include <amps/ampsplusplus.hpp>

Constructing the command:

AMPS::Command cmd(AMPS::Message::Command::Subscribe);
cmd.setTopic(topic);
cmd.setSubId(existingSubId);
cmd.setFilter(newFilter);

AMPS::Options opts;
opts.setReplace();
// set other options to match existing subscription

cmd.setOptions(opts);

The command can now be used in execute or executeAsync.