Skip to main content
100%

Cube Metrics Client (Node.js + WebSockets)

✓ Published0🌍 Public
Mmbostock
Last edited Jan 4, 2012
Created on Jan 4, 2012

This example demonstrates a minimal Node.js client for streaming time-series metric data from a Cube server over WebSockets. It connects to the `/1.0/metric/get` endpoint, sends a JSON query requesting the sum of requests at five-minute intervals over a two-day period, and logs each incoming UTF-8 message until 762 responses arrive. The code uses the `websocket` library to manage the connection, sending a structured query and closing the socket after the expected number of messages is received.

AI-generated description

Similar vizzes