Read the statement by Michael Teeuw here.
Multiple requests to one notification
Let’s take an example where request gets a result, parses it and sends it to the client:
Now how would I go about if I in that getCocktails function wanted to request 2 URL’s, parse them to one combined result and send that as payload with one socket notification?
Or maybe I should do it in a completely different way?
to use an array to hold the concurrent promises and then wait for all to complete (vs any() which triggers if any complete)
@sdetweil Great, thanks a lot! Now I remember I read up on promises a long time ago, but never got around to use it. I’ll try it out when I have the time.
@retroflex YOU might not be using promises, but request() is!..there is also promise.cascade()… a, then b, then c …
@sdetweil thanks again for the tip about promises. I managed to get it working with request-promise and Promise.All in my new MMM-Fortnite module. So now my son is happy
Since the API I’m using is a bit unstable I also tried request-promise-retry package, but never got any usable return value from that. Do you have any experience with retries?
@retroflex i have not tried retry