Class: MessagingStats

ClearBlade. MessagingStats

new MessagingStats() → {Object}

Source:
Returns:
ClearBlade.MessagingStats the created MessagingStats object
Type
Object

Methods

getAveragePayloadSize(topic, start, stop, callback)

Method to retrieve the average payload size for a topic
Parameters:
Name Type Description
topic string Topic to retrieve the average payload size for
start int Point in time in which to begin the query (epoch timestamp)
stop int Point in time in which to end the query (epoch timestamp)
callback function
Source:
Example
cb.MessagingStats().getAveragePayloadSize("mytopic", 1490819666, 1490819676, function(err, body) {
   if(err) {
       //handle error
   } else {
       console.log(body);
   }
});
//returns {"payloadsize":28}

getCurrentSubscribers(topic, callback)

Method to retrieve the number of subscribers for a topic
Parameters:
Name Type Description
topic string Topic to retrieve the current subscribers for
callback function
Source:
Example
cb.MessagingStats().getCurrentSubscribers("mytopic", function(err, body) {
   if(err) {
       //handle error
   } else {
       console.log(body);
   }
});
//returns {"subscribers": 42}

getOpenConnections(callback)

Method to retrieve the number of MQTT connections for a system
Parameters:
Name Type Description
callback function
Source:
Example
cb.MessagingStats().getOpenConnections(function(err, body) {
   if(err) {
       //handle error
   } else {
       console.log(body);
   }
});
//returns {"connections":42}