Seeking some advice on how to use network.request on the following scenario. In my app, there is a need to make a 2nd network call to another server in the event that the first server is unavailable. As such this is what I am currently doing.
local function networkListener2(event) if event.isError then print(event.response) end end local function networkListener(event) if event.isError then network.request(url\_alternative, "GET", networkListener2) else -- do something here end end network.request(url\_main, "GET", networkListener)
With the above codes, I often get the following error though it did manage to get through at times.
failed to connect to /www.xxx.yyy.zzz (port 80) after 30000ms: connect failed: ENETUNREACH (Network is unreachable)
Any advice would be appreciated.