Sync Initialisation


After you have installed the SDK of your preferred programming language. You need to initialise Sync which connects it to our server. Upon connection it verifies the connecting client using a combination of an account ID and application ID. You can get your account and application IDs from the dashboard when you log in.

Hamoni class

The SDK provides a class named Hamoni. This is the entry point into Sync.

If you used the script tag this is a available as a global variable.

If you used npm you can import the module using ES6 or commonjs module pattern

import Hamoni from "hamoni-sync";

To initialise it you need an authentication token. You will generate a token by calling the Sync token API endpoint with your your account ID and application ID.

const accountId = "YOUR_ACCOUNT_ID";
const appId = "YOUR_APP_ID";
const response = await fetch("https://api.sync.hamoni.tech/v1/token", {
  method: "POST",
  headers: {
    "Content-Type": "application/json; charset=utf-8"
  },
  body: JSON.stringify({ accountId, appId })
});

const token = await response.json();

let hamoni = new Hamoni(token);

We recommend you call the API token server with your credentials from your backend and return the token to your client application. This way you don't expose your app keys to the public.

Connect the client by calling connect which returns a promise

hamoni.connect()
      .then( () => //Success handler )
      .catch(error => console.log(error));

Swift SDK coming soon

Java SDK coming soon

results matching ""

    No results matching ""