Initializing the JS Client SDK
Initialize Quantum Fabric client with the following code, and start using the services provided in Quantum Fabric. The initialization method fetches the configuration from Quantum Fabric and saves in the cache. Later, the application uses the cached configuration. It is a synchronous call.
When SDK is initialized, the Quantum SDK registers a session and sends its information to the Quantum Fabric Server. If the device is offline, or the server is not reachable, the session information persists on the device until it can successfully send the information to the Quantum Fabric server.
For more information on application session, refer Standard Report Docs.
- The sessions created by Quantum Fabric's JavaScript SDKs are interactive.
- Based on the browser settings, some browsers store the response of a call in the cache. When another request is made to the same URL, the browser sends the response from the cache instead of directing the call to the server.
To disable response caching, set the Pragma header (as a global request header) to no-cache by using the setGlobalRequestParam() API.
init
//Sample code to initialize Quantum Fabric Client
var appkey = < your - app - key > ;
var appsecret = < your - app - secret >
var serviceURL = < your - service - url > ;
var client = new kony.sdk();
//set Pragma Header to disable the use of response cache in browsers.
client.setGlobalRequestParam("Pragma", "no-cache", client.globalRequestParamType.headers);
client.init(appkey, appsecret, serviceURL, function(response) {
console.log("Init success");
}, function(error) {
console.log("Init Failure");
});