Need help converting a single C# function into Unreal code

I’ve been using this function in Unity for nearly a decade now and can’t imagine coming to Unreal and NOT having this function available to me. I have tried to do this on my own but many parts of this I just cant figure out :frowning:

In particular there are two features of this function that I am still struggling with:

  1. Since there could be multiple calls to this function and this functions waits for a website to send a response I need this to execute as Async. I found Google littered with examples of how to create Async functions… from like a decade or so ago… in UE4.8 and 4.14 etc … but I just can’t seem to get the code to work in UE4.25 :frowning:
  2. When I call the web page I want to parse the result, do some processing on the result and then, finally, pass the result on to one of two predefined delegates. Since every function that calls this function can pass in their own delegates I can’t simply have some static external variables setup to handle the responses since I will have multiple calls to multiple URLs waiting for responses and each will then need to call different delegates.
From what I can see Unreal has you specify a response handler BEFORE you make the call to the URL and while I can pass the delegate functions to the function that initiates the HTTP call, I cannot pass them along to the response handler so I have no idea how to call one of two predefined functions. This is vital, as you will see below, and this is the biggest hurdle I am facing right now...

So, formally, here is my request/plea:
I am looking for someone to convert the Unity code I will paste below into Unreal C++ (ideal, but BP is fine also if that is the only option). It’s just a single function so I don’t really think I can call this a paid gig, hence me using the UNPAID prefix but if you feel you should be compensated for your help and you are not gonna put me in the poor house to convert this function for me then please let me know how much you want for your help and maybe we could do this as a paid assist instead! I am not unwilling to pay for help but I’m just not sure how much to offer someone to write me one single function :wink:

EDIT: Seems my code was cut so I guess I’ll have to explain the logic using Pseudo code:

  1. I call function ContactServer with a bunch of parameters
  2. Append the values of the TArray param to the end of the URL FString to form a GET URL (or do it as POST if it’s not too much hassle)
  3. Make an HTTP call using the specific URL and then wait for the response
  4. Parse the response and based on the content either call the DelegateA or DelegateB params passed to ContactServer (This is where I’m stuck)

That’s it. The end.

There could be multiple calls active at any given time so setting the delegates to call as external variables is not an option but passing the delegates to the response handler doesn’t seem possible in UE4 so I’m stuck. I read that UE4 has multiple methods of doing Async functions based on how many calls / threads you need to use. Well in this case I will have like 3 or 4 calls active max so just keep that in mind when deciding which method is best suited.

So, will anyone rise up and take on this challenge? Is there a kind soul out there that can help me finally move past this function? You have no idea how grateful I would be to finally solve this mystery and move on to learning something else finally! :slight_smile:

I thank you in advance