I tried to API call using below logic inside a Task node.
I test using the Postman tool My File Response takes around 800ms. I applied different below logic and the Results inside a Task node For fetch response from API.
'First Logic
url = "http://MyAPIHost:port/API.json"
rxfer.SetUrl(url)
m.raw = rxfer.GetToString()
json = ParseJSON(m.raw)
'When I performed the First logic. Results are below :
When the Application launch :
- First Time Device Restarted
- Second Time It’s Give Execution Timeout error
- Third Time It’s working
'Second Logic
url = "http://MyAPIHost:port/API.json"
rxfer.SetUrl(url)
m.port = CreateObject("roMessagePort")
rxfer.SetPort(m.port)
rxfer.AsyncGetToString()
m.msg = wait(3000,m.port)
if m.msg = invalid then
rxfer.AsyncCancel()
else
m.raw = m.msg.GetString()
?"m.raw : "m.raw
end if
json = ParseJSON(m.raw)
'When I performed the Second logic. Results are below :
When the Application launch :
- First Time Device Restarted
- Second Time Device Restarted
- Third Time It’s Give Execution Timeout error
- Fourth Time It’s Give Execution Timeout error
- Fifth Time It’s working
Third Logic(Using Internal File):
m.raw = ReadASCIIFile("pkg:/api/API.json")
json = ParseJSON(m.raw)
'When I performed the Third logic. Results are below :
When the Application launch :
- First Time It’s Working
I don’t understand one thing. It’s giving a Execution timeout error. It’s ok but why Roku Device restart’s the Automatic. Does any one knows about this issue?
