Top

rainbowSDK.presence.RAINBOW_ONCONTACTPRESENCECHANGED is not triggered.

Comments

3 comments

  • Sunny Singh

    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 strings
        var 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 login
            var myRainbowPassword = "********"; // Replace by your password

            // The SDK for Web is ready to be used, so you can sign in
            rainbowSDK.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 log
            rainbowSDK.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
    0
    Comment actions Permalink
  • Konrad Hyzy

    Hello,

     

    this bug is going to be fixed in the next SDK version, for the moment you can use an 'old' jQuery listener to retrieve this event.

     

    Best Regards,

    Konrad

    0
    Comment actions Permalink
  • Sunny Singh

    Hello Konrad,

    Thank you for the information.

    Regards,

    Sunny

    0
    Comment actions Permalink

Please sign in to leave a comment.

Still can't find what you need?

  • Contact Us

    Do you have any question about Rainbow? Leave us a message to get more information.

    Contact
  • Ask the Community

    Do you need help? Ask your questions in the Community to get answers from other Rainbow users.

    Post message