Forum Discussion
I already tried which you suggest. My Task node like below :
sub init()
?"Start - init()" m.top.functionName = "MakePostRequest" 'Roku execution skips this line in my case.
?"End - init()" end sub
function MakePostRequest()
?"Start - MakePostRequest" 'The call doesn't come here
readdata = CreateObject("roUrlTransfer") data = "http://Domain:Port" readdata.setUrl(data) readdata.SetMinimumTransferRate(1, 75) ? "data is " data m.port = CreateObject("roMessagePort") readdata.setport(m.port) readdata.gettostring() readdata.SetRequest("POST") request = readdata.AsyncPostFromString(data) ?"request : " request while (true) msg = Wait(0, m.port) statusCode = msg.GetResponseCode() if (Type(msg) = "roUrlEvent") statusCode = msg.GetResponseCode() headers = msg.GetResponseHeaders() if msg.getresponsecode() = 200 then Response = msg.getstring() headers = msg.getresponseheadersarray() ?"Response : " Response exit while else m.top.isError = "true" m.readdata.asynccancel() exit while end if
else ? "wait for data" end if end while
?"End - MakePostRequest"
end function
I make a separate project for this but here also result is the same.
I have to do is stand there until there is a response. Because I created multiple Task nodes and every task node Depends on Each Other. Currently, your ways are happening like => Consider I used 3 Task node. so First It's 2nd Task node Response comes. After 3rd Task node Response comes then it's Run 1st Task node Response comes. But I need to run 1st, 2nd, 3rd wise.
Are you sure that your "task" xml extends task? not sure why it would skip that line. "functionName" is the field that is called as a function when you "run" a task.
https://developer.roku.com/docs/references/scenegraph/control-nodes/task.md
since this is a task and not blocking, omit the while loop and don't do async
urlhost = CreateObject("roUrlTransfer") urlhost.SetCertificatesFile("common:/certs/ca-bundle.crt") urlhost.AddHeader("X-Roku-Reserved-Dev-Id", "") urlhost.InitClientCertificates() urlhost.SetUrl(m.top.url) rsp = urlhost.GetToString() ResponseJSON = ParseJSON(rsp)