Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cube Metrics Client (Node.js + WebSockets)
var websocket = require("websocket");
var client = new websocket.client();
client.on("connect", function(connection) {
var remaining = 762; // based on start, stop, and step
connection.on("message", function(message) {
if (message.type === "utf8") {
if (!--remaining) connection.close();
console.log(message.utf8Data);
}
});
connection.sendUTF(JSON.stringify({
expression: "sum(request)",
start: "2011-09-10T12:37:12Z",
stop: "2011-09-13T04:00:02Z",
step: 300000
}));
});
client.connect("ws://localhost:1081/1.0/metric/get");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.