HISE Logo Forum
    • Categories
    • Register
    • Login

    Server.setBaseURL

    Scheduled Pinned Locked Moved General Questions
    9 Posts 4 Posters 247 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.
    • T
      TNTHM
      last edited by

      I am trying to set the URL for server communication. I thought I would be able to use it in the onInit of a Script FX module but it is giving an error saying Unknown function 'setBaseURL'. How can I use this function?

      LindonL d.healeyD 2 Replies Last reply Reply Quote 0
      • LindonL
        Lindon @TNTHM
        last edited by Lindon

        @TNTHM

        Link Preview Image
        HISE | Docs

        favicon

        (docs.hise.audio)

        HISE Development for hire.
        www.channelrobot.com

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

          @TNTHM It's for use in midi processors. I don't think it will work in a script effect

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

          Christoph HartC 1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey yup most of the UI related classes are not present in anything else than the Script MidiProcessor.

            T 1 Reply Last reply Reply Quote 1
            • T
              TNTHM @Christoph Hart
              last edited by

              Is it possible to communicate with a server through the plugin? I have set up a server at http://localhost:3000 and I am trying to send data to it when a button on the GUI is clicked. In the code below, which is in the onInit of the Interface, 4 and 5 print but 6 does not. Is there a way to have the plugin communicate with a server?

              inline function onButton1Control(number, value)
              {
              	Console.print("4");
              
                 // if the button was clicked
                  if (value == 1)
                  {
              	Console.print("5");
              
                      // Send data to the server and wait for the response
                      Server.callWithPOST("http://localhost:3000", data, function(status, response) {
                          Console.print("6");
                          
                          // HTTP status 200 means the request was successful
                          if (status == 200) 
                          {
                              // print a success message to the HISE console
                              Console.print("Successfully sent data to the server");
                          }
                          else
                          {
                              Console.print("Error occurred while contacting the server: " + status);
                          }
                      });
                  }
              }
              
              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @TNTHM
                last edited by

                @TNTHM For testing with a local server you'll need to use the IP address. Have you declared data?

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

                T 1 Reply Last reply Reply Quote 1
                • T
                  TNTHM @d.healey
                  last edited by

                  @d-healey I did declare data. And I confirmed that the server is running on port 3000 through terminal. When I replaced localhost with my computer's IP address it still does not print 6.

                  Content.makeFrontInterface(600, 600);
                  
                  Console.print("1");
                  const var Button1 = Content.getComponent("Button1");
                  Console.print("2");
                  var data = {
                      message: "Hello world!"
                  };
                  Console.print("3");
                  inline function onButton1Control(number, value)
                  {
                  	Console.print("4");
                  
                       // if the button was clicked
                      if (value == 1) 
                      {
                  	Console.print("5");
                  
                          // Send data to the server and wait for the response
                          Server.callWithPOST("http://localhost:3000", data, function(status, response) {
                              Console.print("6");
                              if (status == 200) // HTTP status 200 means the request was successful
                              {
                                  // print a success message to the HISE console
                                  Console.print("Successfully sent data to the server");
                              }
                              else
                              {
                                  Console.print("Error occurred while contacting the server: " + status);
                              }
                          });
                      }
                  }
                  Button1.setControlCallback(onButton1Control);
                  
                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @TNTHM
                    last edited by

                    @TNTHM You haven't called Server.setBaseURL()

                    Check out all the server documentation - https://docs.hise.audio/scripting/scripting-api/server/index.html

                    94d1151f-05b4-4619-8905-16ba57b8666b-image.png

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

                    T 1 Reply Last reply Reply Quote 1
                    • T
                      TNTHM @d.healey
                      last edited by

                      @d-healey This was what I was missing. Thank you!

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

                      21

                      Online

                      1.7k

                      Users

                      11.8k

                      Topics

                      102.4k

                      Posts