Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including with all npm packages installed. Try it out:

var statsdSocketIo = require("")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors. v0.0.6

StatsD backend to emit stats over Build Status

StatsD backend to emit stats over This backend allows you to subscribe to individual stats, groups of stats, or all stats and handle them in real time.


There are a few ways to install to be used as a StatsD backend. You can add it to the StatsD package.json and run npm install.

The simplest way to install the module is to run:

  $ npm install



To add this backend to the StatsD daemon, simply add the following settings to the StatsD configuration file:

  socketPort: 8000,
  backends: ['']

If you want to keep the graphite backend installed, you need to include './backends/graphite' in the backends configuration.


var socket = require('').connect('http://localhost:8000');
socket.on('connect', function () {
  socket.emit('subscribe', 'all');
  socket.emit('subscribe', 'timers');
  socket.emit('subscribe', 'gauges.server1.cpu');
  socket.emit('subscribe', 'gauges.*.cpu');

// Retrieve all stats
socket.on('all', function (data) {
  console.log('ALL:' + data);

// Retrieve a groups of stats
socket.on('timers', function (data) {

// Retrieve a single stat
socket.on('gauges.server1.cpu', function (data) {
  console.log('Server1 CPU:' + data);

// Supports wildcards
socket.on('gauges.*.cpu', function (data) {
  for (var server in data.gauges) {
    console.log(server + ' CPU:' + data.gauges[server]['cpu']);

This example shows using on the server side but can just as easily be implemented on the client side. See the documentation for more information.


To run the tests:

npm test


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free