Lucag7 Member Nov 21, 2025 #1 I have a function that returns a value and uses Wait For on another function, which itself uses an HttpJob (so it also contains a Wait For). I’m also using another Wait For on a CallSub that calls the first function. Code: Copy sub s1 wait for(callsub(C2, "test")) complete (resp as String) log(resp) end sub Code: Copy sub test as ResumableSub wait for (request("/test")) complete (resp1 as String) return resp end sub sub request(endpoint as String) as ResumableSub Wait For (j) JobDone(j As HttpJob) return j.GetString end sub I use this method to generalize the various JSON requests. I have a service module (in this example represented by class C2) with a single function that handles all the requests, adjusting the endpoint each time. In addition, I have several small functions that format the endpoint to be used (such as the test function), so that these functions can also be called from other classes. This method works, but I’m not sure whether it’s the correct approach. Could it cause issues, or is it a valid way to handle this sequence of asynchronous calls? Would it be better to use a different approach?
I have a function that returns a value and uses Wait For on another function, which itself uses an HttpJob (so it also contains a Wait For). I’m also using another Wait For on a CallSub that calls the first function. Code: Copy sub s1 wait for(callsub(C2, "test")) complete (resp as String) log(resp) end sub Code: Copy sub test as ResumableSub wait for (request("/test")) complete (resp1 as String) return resp end sub sub request(endpoint as String) as ResumableSub Wait For (j) JobDone(j As HttpJob) return j.GetString end sub I use this method to generalize the various JSON requests. I have a service module (in this example represented by class C2) with a single function that handles all the requests, adjusting the endpoint each time. In addition, I have several small functions that format the endpoint to be used (such as the test function), so that these functions can also be called from other classes. This method works, but I’m not sure whether it’s the correct approach. Could it cause issues, or is it a valid way to handle this sequence of asynchronous calls? Would it be better to use a different approach?
W walt61 Well-Known Member Licensed User Longtime User Nov 21, 2025 #2 I'm not sure if Callsub could cause issues, but just for the sake of simpler code, I would make C2.test a Public Sub, and in Class C1 do something like this: Code: Copy dim c2x as c2 c2x.Initialize '... wait for(c2x.test) complete (resp as String) Upvote 0
I'm not sure if Callsub could cause issues, but just for the sake of simpler code, I would make C2.test a Public Sub, and in Class C1 do something like this: Code: Copy dim c2x as c2 c2x.Initialize '... wait for(c2x.test) complete (resp as String)