Displaying notification from my server via API

  • I have a script that checks my server and reads a js file via API for the latest version. If a newer version if found, it is supposed to display a notification button, which when clicked displays a panel with text pulled from the server.

    In the console, I can see that the API is working correctly and the response is correct. It shows all the data from the js file.
    However, I am doing something wrong here, as I am getting an error and the button won't show.

    Here is what I have onInit:

    //-----------Notifications based on current version number-------
    const var VersionLabel = Content.getComponent("VersionLabel");
    reg versionNumber= Engine.getVersion(); //pull the current version# from the software
    VersionLabel.set("text", "v "+versionNumber); //display the current version on the interface
    reg vn= versionNumber.split('.'); //Turn the current version number into an array;
    const var p = {
        "request": "version"
    reg an;
    reg NotificationURL;
    Server.callWithGET("/world_percussion_version", p, function(status, response)
         an = response;
    const var NotificationMessage = Content.getComponent("NotificationMessage");
    const var NotificationTitle = Content.getComponent("NotificationTitle");

    The problem is onTimer:

    function onTimer()
            Console.print("Timer stopped");
            //Setting variables from server information
            NotificationMessage.set("text", an["NotificationMessage"]);
            NotificationTitle.set("text", an["NotificationTitle"]);
            NotificationURL = an["NotificationURL"];
            var newVersion = an["version"].split('.');
            //Comparing versions
           if (newVersion[0] > vn[0] || (newVersion[0] == vn[0] && newVersion[1] > vn[1]) || (newVersion[0] == vn[0] && newVersion[1] == vn[1] && newVersion[2] > vn[2])){

    I receive the following error

    Interface:! onTimer() - Line 8, column 32: Illegal operation in audio thread: HeapBlock allocation

    What am I missing/doing wrong here?

    I should note that a developer I hired, made this work, but that she was using a standalone HISE through Visual Studio. It is not working for me using the plugin version of HISE (latest Scriptnode).

    Thank you!

    1. Don't use the inbuilt timer callback, it's for real-time event processing.
    2. Why do you use a timer at all? Just put the logic into the server callback.

  • @Christoph-Hart Thank you so much! I can't believe that I actually made it work just by following your advice 🙂 Seems like I am beginning to understand things. Thank you so much 🤜 🤛

Log in to reply