logo Developer API
Real-time Notifications: Websockets


Intro

Welcome to the BitSkins Developer API. This document details how to access real-time updates on the BitSkins platform through our Websockets.

Accessing our Websockets require use of the Pusher library for websockets. There is no need to purchase a Pusher subscription; the documentation below tells you how to access our Websockets using open-source libraries.

The various events listed on this page provide real-time updates so you can see the events as they are triggered. The information posted for each event should be self-explanatory. If you have trouble understanding the data, please contact us.

Please note Websockets are, by design, not a loss-less method of delivery. You should complement your implementation of Websockets with periodic queries via our REST API to remain informed on the changes to data you monitor via the Websockets.


Using the Websockets

  
// first, install the pusher-client library via "npm install pusher-client@1.1.0"

var Pusher = require('pusher-client');

var pusher = new Pusher('c0eef4118084f8164bec65e6253bf195', {
        encrypted: true,
        wsPort: 443,
        wssPort: 443,
        host: 'notifier.bitskins.com'
    });

pusher.connection.bind('connected', function() {
        // connected to realtime updates 
        console.log(" -- connected to websocket");
    });

pusher.connection.bind('disconnected', function() {
        // not connected to realtime updates
        console.log(" -- disconnected from websocket");
    });

var events_channel = pusher.subscribe(CHANNEL); // use the relevant channel, see docs below

events_channel.bind(EVENT_TYPE, function(data) {
        // use the relevant event type, see docs below
        // print out any data received for the given event type
        console.log(" -- got data: " + JSON.stringify(data));
    });

  

Public: Item Listed

This event is fired whenever a new (purchasable) item becomes available.

Event Type
listed
Channel
inventory_changes

Waiting for data...


Public: Item Delisted/Sold

This event is fired whenever an item is no longer available for sale.

Event Type
delisted_or_sold
Channel
inventory_changes

Waiting for data...


Public: Item Price Changed

This event is fired whenever an item's price is changed.

Event Type
price_changed
Channel
inventory_changes

Waiting for data...


Public: Extra Item Info

This event is fired whenever extra information becomes available for an item.

Event Type
extra_info
Channel
inventory_changes

Waiting for data...