API Docs for version 1.2.6900

Circuit Module

Summary

Circuit SDK module.

Main class is Client which exposes the messaging and real-time APIs for a particular user.

Here is an example that creates a client instance, performs a login, registers for an itemAdd event and sends a new text message.

// Create Circuit client instance
var client = new Circuit.Client({
    client_id: '<your client_id>',
    domain: '<circuit system, defaults to circuitsandbox.net>'
});

// Authenticate with OAuth2. User will see the Circuit OAuth2 popup.
client.logon()
.then(user => {
    // Listen for itemAdded event
    client.addEventListener('itemAdded', evt => console.log('Item received:', evt.item));
    // Send text item on a specific conversation
    client.addTextItem('3154f545-1a6a-493a-8448-3c5cfa5a6b11', 'Hello World')
      .then(item => console.log('Item:', item))
      .catch(console.error);
});

View the examples on circuit.github.io.

New to Circuit? Register for a free developer account.

This module is a rollup of the following modules: