rainbowSDK.presence.RAINBOW_ONCONTACTPRESENCECHANGED is not triggered.
Hello,
I have created a simple web application and the user contacts presence event is not triggered when the presence of a contact in the user's contact list is changed.
I am sharing the example code snippet below .
var onContactPresenceChangeEvent = function onContactPresenceChangeEvent(event) {
console.log("DEMO :: presence changed to ", event.detail);
};
Thanks and regards,
Sunny
-
Hello,
I am sharing my sample code below,
None of the presence event getting trigger when the presence status of a user in the contact list is changed.
/* Wait for the page to load */$(document).ready(function() {console.log("[DEMO] :: Rainbow Application started!");
// Update the variables below with your applicationID and applicationSecret stringsvar applicationID = "********",applicationSecret = "********";
/* Bootstrap the SDK */angular.bootstrap(document, ["sdk"]).get("rainbowSDK");
/* Callback for handling the event 'RAINBOW_ONREADY' */var onReady = function onReady() {var myRainbowLogin = "thiyam.sunny*******"; // Replace by your loginvar myRainbowPassword = "********"; // Replace by your password
// The SDK for Web is ready to be used, so you can sign inrainbowSDK.connection.signin(myRainbowLogin, myRainbowPassword).then(function(account) {// Successfully signed to Rainbow and the SDK is started completely. Rainbow data can be retrieved.//...}).catch(function(err) {// An error occurs (e.g. bad credentials). Application could be informed that sign in has failed//...});};
/* Callback for handling the event 'RAINBOW_ONCONNECTIONSTATECHANGED' */var onLoaded = function onLoaded() {console.log("[DEMO] :: On SDK Loaded !");
// Activate full SDK lograinbowSDK.setVerboseLog(true);
rainbowSDK.initialize(applicationID, applicationSecret).then(function() {console.log("[DEMO] :: Rainbow SDK is initialized!");}).catch(function(err) {console.log("[DEMO] :: Something went wrong with the SDK...", err);});};
var onContactPresenceChanged = function onContactPresenceChanged(event) {console.log("[DEMO] :: onContactPresenceChanged!");};
var onPresenceChanged = function onPresenceChanged(event) {console.log("[DEMO] :: onPresenceChanged!");};
var onContactRichPresenceChanged = function onContactRichPresenceChanged(event) {console.log("[DEMO] :: onContactRichPresenceChanged!");};
var onReachPresenceChanged = function onReachPresenceChanged(event) {console.log("[DEMO] :: onContactRichPresenceChanged!");};
var onConnectionStateChangeEvent = function onConnectionStateChangeEvent(event) {console.log("[DEMO] :: onContactRichPresenceChanged!");};
/* Listen to the SDK event RAINBOW_ONREADY */document.addEventListener(rainbowSDK.RAINBOW_ONREADY, onReady)
/* Listen to the SDK event RAINBOW_ONLOADED */document.addEventListener(rainbowSDK.RAINBOW_ONLOADED, onLoaded)
document.addEventListener(rainbowSDK.presence.RAINBOW_ONCONTACTPRESENCECHANGED, onContactPresenceChanged)document.addEventListener(rainbowSDK.presence.RAINBOW_ONPRESENCECHANGED, onPresenceChanged)document.addEventListener(rainbowSDK.presence.RAINBOW_ONCONTACTRICHPRESENCECHANGED, onContactRichPresenceChanged)document.addEventListener(rainbowSDK.presence.RAINBOW_ONRICHPRESENCECHANGED, onReachPresenceChanged)document.addEventListener(rainbowSDK.connection.RAINBOW_ONCONNECTIONSTATECHANGED,onConnectionStateChangeEvent)
/* Load the SDK */rainbowSDK.load();});Regards,Sunny
Please sign in to leave a comment.
Comments
3 comments