npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spacebunny

v1.1.2

Published

NodeJS client library for Space Bunny IoT platform

Readme

NPM

Space Bunny is the IoT platform that makes it easy for you and your devices to send and exchange messages with a server or even with each other. You can store the data, receive timely event notifications, monitor live streams and remotely control your devices. Easy to use, and ready to scale at any time.

This is the source code repository for Node SDK. Please feel free to contribute!

Installation

npm install spacebunny --save

Basic usage

Device

Devices can publish messages on configured channels and receive messages on their inbox channel

AMQP publisher

In this example a device publishes a single message on the first configured channel

'use strict';
var AmqpClient = require('spacebunny').AmqpClient;
// Use your Api Key
var connectionParams = { apiKey: 'your-api-key' };
var amqpClient = new AmqpClient(connectionParams);
var content = { some: 'json' };
var channels = amqpClient.channels();
amqpClient.publish(channels[0], content).then(function(res) {
  console.log('Message published!');
  amqpClient.disconnect();
  process.exit(0);
}).catch(function(reason) {
  console.error(reason);
  process.exit(1);
});

AMQP receiver

In this example a device waits for incoming messages on its inbox channel

'use strict';
var AmqpClient = require('spacebunny').AmqpClient;
// callback called whan a message is received
var messageCallback = function(content, field, properties) {
  console.log(content);
};
// Use your Api Key
var connectionParams = { apiKey: 'your-api-key' };
var amqpClient = new AmqpClient(connectionParams);
amqpClient.onReceive(messageCallback).then(function(res) {
  console.log('Start receiving..');
}).catch(function(reason) {
  console.error(reason);
});

For more advanced usage please refer to example files in examples folder

Stream

A stream client can read from multiple live streams hooks

AMQP streamer

In this example the streamer receives all messages from stream my-stream and my-stream-2

'use strict';
var AmqpStreamClient = require('spacebunny').AmqpStreamClient;
// callback called when a message is received
var messageCallback = function(content, field, properties) {
  console.log(content);
};
// Use your client ID and secret
var connectionParams = {
  client: 'your-client-id',
  secret: 'your-secret'
};
var streamClient = new AmqpStreamClient(connectionParams);
// Use your stream name
var streamHooks = [
  { stream: 'my-stream', callback: messageCallback },
  { stream: 'my-stream-2', callback: messageCallback }
];
streamClient.streamFrom(streamHooks).then(function(res) {
  console.log(res);
}).catch(function(reason) {
  console.error(reason);
});

For more advanced usage please refer to example files in examples folder

Usage within a web page (plain JS)

Space Bunny Node SDK is bundled using Webpack to allow the integration of the library within a web page

Device

STOMP receiver and publisher

In this example a device waits for incoming messages on its inbox channel and publishes a single message on the first configured channel

<script src="https://github.com/space-bunny/node-sdk/blob/master/lib/spacebunny.var.js"></script>
<script>
  [...]
  // Use your Api Key
  var connectionParams = { apiKey: 'your-api-key' };
  var webStompClient = new StompClient(connectionParams);
  webStompClient.onReceive(messageCallback).then(function(res) {
    console.log('Successfully connected!');
  }).catch(function(reason) {
    console.error(reason);
  });
  var content = { some: 'json' };
  var channels = webStompClient.channels();
  webStompClient.publish(channels[0], content).then(function(res) {
    console.log('Message published!');
  }).catch(function(reason) {
    console.error(reason);
  });
  [...]
</script>

For more advanced usage please refer to example files in public and examples folders

Stream

A stream client can read from multiple live streams hooks

STOMP streamer

In this example the streamer receives all messages from stream my-stream and my-stream-2

<script src="https://github.com/space-bunny/node-sdk/blob/master/lib/spacebunny.var.js"></script>
<script>
  [...]
  var connectionParams = {
    client: 'your-client-id',
    secret: 'your-secret'
  };
  var streamClient = new StompStreamClient(connectionParams);
  // Use your stream name
  var streamHooks = [
    { stream: 'my-stream', callback: messageCallback },
    { stream: 'my-stream-2', callback: messageCallback }
  ];
  streamClient.streamFrom(streamHooks).then(function(res) {
    console.log(res);
  }).catch(function(reason) {
    console.error(reason);
  });
  [...]
</script>

For more advanced usage please refer to example files in public and examples folders

Run NODE examples

Examples cover device and stream scenarios:

AMQP

npm run start:node-sample examples/device/amqp/receiver.js -- --deviceKey=my-device-key
npm run start:node-sample examples/device/amqp/publisher.js -- --deviceKey=my-device-key --channel=data
npm run start:node-sample examples/stream/amqp/streamer.js -- --client=client-id --secret=secret
 --stream=data --stream=alarms

MQTT

npm run start:node-sample examples/device/mqtt/receiver.js -- --deviceKey=my-device-key
npm run start:node-sample examples/device/mqtt/publisher.js -- --deviceKey=my-device-key --channel=data
npm run start:node-sample examples/stream/mqtt/streamer.js -- --client=client-id --secret=secret
 --stream=data --stream=alarms

STOMP

npm run start:node-sample examples/device/stomp/receiver.js -- --deviceKey=my-device-key
npm run start:node-sample examples/device/stomp/publisher.js -- --deviceKey=my-device-key --channel=data
npm run start:node-sample examples/stream/stomp/streamer.js -- --client=client-id --secret=secret
 --stream=data --stream=alarms

For more advanced usage please refer to example files in public and examples folders

Run HTML examples

npm run start:samples

Examples will be available on port 8080

Build dist version

npm run build

Generate documentation

npm run docs

License

The library is available as open source under the terms of the MIT License.