Search…
JavaScript SDK
A lightweight JavaScript library to send data from your Android application to your DCN in real time.
The JavaScript SDK makes it easy to integrate your sites with your DCN. It can be installed as a ES6 compatible npm module paired with module bundlers such as webpack or browserify, or can be loaded on a webpage directly by referencing a release build from the page HTML via a <script> tag.
Details on installing and using the web SDK can be found in the Github README. A demo of various SDK functionalities can be seen on demo.optable.co.

Creating a site (JavaScript SDK) source

To create a site source, you will need to specify a unique name for the site and configure the list of allowed HTTP origins that are allowed to connect to your DCN using the web SDK. For example, using the CLI:
$ optable-cli source create site "my-example-site" \
"https://foo.com" "https://bar.com"
On success, the command will return a JSON encoded description of the newly created site source. Take note of the slug attribute as you will need it along with the hostname of your DCN when initializing the JavaScript SDK on your site as described in the SDK GitHub README.
Make sure to configure all of the allowed HTTP origins correctly when creating the site source, otherwise you will get Cross-Origin Resource Sharing (CORS) exceptions from your web browser. You can add additional HTTP origin URIs by editing the site source from your DCN UI.
Last modified 3mo ago
Copy link