HISE Logo Forum
    • Categories
    • Register
    • Login

    Server.callWithGET

    Scheduled Pinned Locked Moved General Questions
    15 Posts 5 Posters 403 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Matt_SFM
      Matt_SF @DanH
      last edited by

      @DanH I'm not in front of my computer, but wouldn't it work if you use

      if(response != "") 
      
      // or
      
      if(response != undefined) 
      

      And then check the version number...?

      Develop branch
      Win10 & VS17 / Ventura & Xcode 14. 3

      DanHD 1 Reply Last reply Reply Quote 0
      • DanHD
        DanH @Matt_SF
        last edited by

        @Matt_SF @Lindon Thanks both, will try these....

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @DanH
          last edited by DanH

          @Matt_SF @Lindon not having any joy with those - perhaps I'm using them wrong? Currently the if(response != undefined) executes every time. The response is a 'file does not exist' error generated by the server...

          function VersionCheck()
          {
          	
          	Server.setBaseURL("https://");	
          	Server.callWithGET("coolfile.json", VV, function(status, response) {
          
          	if(response != undefined) 
          	{
          		Console.print("it's not there");
          		Update_Panel.showControl(0);
          		Console.print(response);
          	}
          
          	else if (response.HVERSION > VERSION)
          	{
          		Update_Panel.showControl(1);
          	}
          	
          	else
          	{
          		Update_Panel.showControl(0);
          	}
          
          	});
          
          }
          
          VersionCheck();
          

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @DanH
            last edited by

            @DanH What response do you return from your server?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            DanHD 1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @d.healey
              last edited by

              @d-healey I just get data out of a file...

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

              Matt_SFM 1 Reply Last reply Reply Quote 0
              • Matt_SFM
                Matt_SF @DanH
                last edited by

                @DanH what if you use the status instead?

                If the file doesn't exist you'll get a 404 code...

                Develop branch
                Win10 & VS17 / Ventura & Xcode 14. 3

                DanHD 2 Replies Last reply Reply Quote 0
                • DanHD
                  DanH @Matt_SF
                  last edited by

                  @Matt_SF well another issue is that if the user is not online then the update message also displays... That's an easier check to do though I think

                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                  https://dhplugins.com/ | https://dcbreaks.com/
                  London, UK

                  DanHD 1 Reply Last reply Reply Quote 0
                  • DanHD
                    DanH @DanH
                    last edited by

                    Maybe I can just check that the file exists first though before executing any Server commands?

                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                    https://dhplugins.com/ | https://dcbreaks.com/
                    London, UK

                    1 Reply Last reply Reply Quote 0
                    • DanHD
                      DanH @Matt_SF
                      last edited by

                      @Matt_SF ok so yes I get a 404 code in an html error message - how can I use that? I'm just thinking if my server goes down (which it did the other day) I don't want loads of people thinking there's an update available 😆

                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                      https://dhplugins.com/ | https://dcbreaks.com/
                      London, UK

                      DanHD Matt_SFM 2 Replies Last reply Reply Quote 0
                      • DanHD
                        DanH @DanH
                        last edited by

                        ok found this in docs... will try!

                        if(status == Server.StatusOK)
                        

                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                        https://dhplugins.com/ | https://dcbreaks.com/
                        London, UK

                        1 Reply Last reply Reply Quote 0
                        • Matt_SFM
                          Matt_SF @DanH
                          last edited by

                          @DanH you can check if the user is online with Server.isOnline

                          Simply :

                          	if(status == 404) 
                          	{
                          		Console.print("it's not there");
                          		Update_Panel.showControl(0);
                          		return;
                          	}
                          

                          Just FYI, I form myself, am using a custom api route (wordpress) which outputs an object like this :

                          {
                              'MajorVersion'=>'1',
                              'MinorVersion'=>'0',
                              'Patch'=>'0',
                              'isActivated'=> false  
                          };
                          

                          The ``ìsActivated``` key allows me to control if I want the update info to be displayed in the plugin or not.

                          Develop branch
                          Win10 & VS17 / Ventura & Xcode 14. 3

                          DanHD 1 Reply Last reply Reply Quote 0
                          • DanHD
                            DanH @Matt_SF
                            last edited by

                            @Matt_SF Thanks! Using Server.isOnline currently, and

                            if(status == Server.StatusOK)
                            

                            is working well... @Christoph-Hart what is this checking exactly?

                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                            https://dhplugins.com/ | https://dcbreaks.com/
                            London, UK

                            Christoph HartC 1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart @DanH
                              last edited by

                              Server.StatusOK is just 200 which is the official HTTP response code for "everything alright buddy, you're doing great, that's a fabulous request you've made here!"

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              23

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.4k

                              Posts