MsSupportSdk Class
Global object reference for the Microsoft Support Web SDK
Methods
init
(
Promise
static
-
config
Initialize the SDK
Parameters:
-
config
Objecta collection of initialization parameters that control the setup of the SDK
-
partnerId
Stringa uniquely identifying string to differentiate telemetry per partner
-
appId
Stringa uniquely identifying string to differentiate telemetry per partner app
-
sessionId
Stringa unique id used for tracking purpose. SDK will generate one if not supplied
-
correlationVector
Stringjsll correlation vector. SDK will generate one if not supplied
-
logger
Stringa custom logger which must expose a writeEvent(data) method. The 'data' param can be an IncomingRequest, OutgoingReqeust or ClientError
-
Returns:
Promise:
a promise that resolves when the SDK is loaded and rejects when loading fails
Example:
var sdk = winodw && window.MsSupportSdk; // Get a reference to the global MsSupportSdk object
// var sdk = require("MsSupportSdk"); // Load the Web SDK module using a module loader. i.e. requirejs
// uncomment to use custom logger for Qos events
// var customLogger = {
// writeEvent: function(data) {
// console.log(JSON.stringfy(data));
// }
// };
if(sdk) {
var sdkConfig = {
partnerId: "SomePartnerId",
appId: "SomeAppId",
sessionId: "123-456-789", // this is optional
correlationVector: "AQnf0OTUGFKmhX46.0", // this is optional
// logger: customLogger // uncomment to use custom logger to log Qos events
};
sdk.init(sdkConfig).then(
function(){
console.log("Microsoft Support SDK initialized.");
},
function(err){
console.log("Unabled to initialize Microsoft Support SDK. Error: " + err.message);
});
}