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 🙏

© 2024 – Pkg Stats / Ryan Hefner

bigbang.io

v0.0.18

Published

Create real-time applications and devices for the Internet of Things.

Downloads

4

Readme

Big Bang Javascript Client SDK

NPM

Big Bang lets you create realtime applications in seconds. It makes event streaming and data synchronization a snap!

The Javascript Client SDK works in modern browsers and Node.js. Take your pick, or use both.
It is available via npm and Bower

Installation

npm install bigbang.io --save

or

bower install bigbang.io --save

Example

var client = new BigBang.Client('https://demo.bigbang.io');
client.connect(function(err) {
    if (err) return;
    console.log('Connected as ' + client.getClientId());
    
    client.subscribe('my-channel', function(err, channel) {
        if (err) return;
        channel.on('message', function(message) {
            console.log(message.senderId + ' said ' + message.payload.getBytesAsJSON().message);
        });	        
        channel.publish({ message : 'Hi everybody!' });

        var channelData = channel.getChannelData();
        channelData.on('add', function(key, value) {
            console.log('Someone set ' + key + ' to ' + value);
        });
        channelData.put('colors', ['red', 'green', 'blue']);
    });
});

Browser Note

If you are using Big Bang in browser without any sort of dependency management, just add the minified .js file. There are no longer any external dependencies, everything included!

<script type="text/javascript" src="js/bigbang.io.min.js"></script>

Servers

To connect to Big Bang you'll need a URL. You can use http://demo.bigbang.io to try things out. When you are ready, you can create your own application at https://cloud.bigbang.io/.

Channels

Channels are publish/subscribe. You can subscribe to a Channel to get any messages that are published to it. You can publish a message to send it to all subscribers.

See Client#subscribe() for more!

Channel Data

Channels can have key/value pairs called ChannelData associated with them. These persist as long as the Channel is active and they are automatically synchronized to all subscribers of the channel.

See Channel#getChannelData() for more!

API

BigBang.Client

Client manages your connection to the server and lets you interface with Channels.

var client = new BigBang.Client('https://demo.bigbang.io');
client.connect(function(err) {
    if (err) return;
    console.log('Connected as ' + client.getClientId());
});

client.connect(function(err))

Connect to a Big Bang application at url.

Params

  • callback (Error)

client.disconnect()

Disconnect from the server.

client.subscribe(channelName, options, function(err, channel))

Subscribe to a channel called channelName. channel will be a Channel object.

Params

  • channelName string

  • callback (Error,Channel)

client.getClientId():

Your unique identifier for this session. This identifies you to the server and to other users.

Returns string clientId

client.getChannel(channelName)

Get a reference to the Channel object for the subscribed channel called channelName.

Params

  • channelName string

Returns Channel

Events

client.on('disconnected', function(reason)):

Event is fired when the client has been disconnected, either from calling disconnect() or for reasons beyond your control.

BigBang.Channel

client.subscribe('my-channel', function(err, channel) {
    if (err) return;
    channel.on('message', function(message) {
        console.log(message.senderId + ' said ' + message.payload.getBytesAsJSON().message);
    });	        
    channel.publish({ message : 'Hi everybody!' });
});

channel.publish(obj, function(err))

Publish obj to the channel. obj must be an object or array (for now).

Params

  • obj object:array A javascript object or array
  • callback (Error) Error if publish fails or is rejected

channel.getChannelData(namespace)

Returns a ChannelData object for the given namespace. If no namespace is supplied a default will be used. Namespaces can be used to organize your channel's data.

Params

  • namespace string

Returns ChannelData

channel.getNamespaces()

Get the current ChannelData namespace names as an Array

Returns ChannelData or null if namespace does not exist.

channel.getSubscribers()

Returns Array The clientIds of the current subscribers on this channel as an Array.

channel.unsubscribe(function())

Unsubscribe from the current channel.

Events

channel.on('message', function(msg) )

Fired when a message is received on the channel

channel.on('join', function(clientId))

Fired when a subscriber joins the channel.

channel.on('leave', function(clientId))

Fired when a subscriber leaves the channel.

BigBang.ChannelData

var channelData = channel.getChannelData();
channelData.on('add', function(key, value) {
    console.log('Someone set ' + key + ' to ' + value);
});
channelData.put('colors', ['red', 'green', 'blue']);

channelData.get(key)

Params

  • key string

Returns object|Array Return value associated with key, or null if the key does not exist

channelData.put(key, value)

Set the value for key.

Params

  • key string
  • value object|Array

channelData.remove(key):

Remove the value associated with key.

Events

channelData.on('add', function(key, value))

Fires when a new key and value is added.

channelData.on('update', function(key, value))

Fires when a key's value is updated.

channelData.on('remove', function(key))

Fired when a key (and it's value) is removed.

channelData.on(key, function(value, operation))

Fired when anything happens to key. value will be the new value or null in the case of a remove. operation is one of add, update or remove. This event is an easy way to monitor a single key.