new options for cobra commands
- ws cobra_subscribe has a new -q (quiet) option - ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) - ws cobra_subscribe, cobra_to_statsd and cobra_to_sentry commands have a new option, --filter to restrict the events they want to receive
This commit is contained in:
@ -429,12 +429,18 @@ namespace ix
|
||||
}
|
||||
|
||||
void CobraConnection::subscribe(const std::string& channel,
|
||||
SubscriptionCallback cb)
|
||||
const std::string& filter,
|
||||
SubscriptionCallback cb)
|
||||
{
|
||||
// Create and send a subscribe pdu
|
||||
Json::Value body;
|
||||
body["channel"] = channel;
|
||||
|
||||
if (!filter.empty())
|
||||
{
|
||||
body["filter"] = filter;
|
||||
}
|
||||
|
||||
Json::Value pdu;
|
||||
pdu["action"] = "rtm/subscribe";
|
||||
pdu["body"] = body;
|
||||
|
@ -75,7 +75,9 @@ namespace ix
|
||||
|
||||
// Subscribe to a channel, and execute a callback when an incoming
|
||||
// message arrives.
|
||||
void subscribe(const std::string& channel, SubscriptionCallback cb);
|
||||
void subscribe(const std::string& channel,
|
||||
const std::string& filter = std::string(),
|
||||
SubscriptionCallback cb = nullptr);
|
||||
|
||||
/// Unsubscribe from a channel
|
||||
void unsubscribe(const std::string& channel);
|
||||
|
Reference in New Issue
Block a user