The roUrlTransfer has the AsyncGetToString method which performs async requests. However, in order to receive events from this, you must wait on a message port associated with it. The waits are blocking, so how is this truly async, or am I missing something?
You can do other work before you wait for the transfer events. You can do a non-blocking poll by waiting with a short timeout so that you can check if the transfer is complete and do something else if it isn’t done yet.
–Mark
“RokuMarkn” wrote:
You can do other work before you wait for the transfer events. You can do a non-blocking poll by waiting with a short timeout so that you can check if the transfer is complete and do something else if it isn’t done yet.–Mark
Are messages sent to a port cached? Maybe this was my misunderstanding. I thought that if an event occurred without a Wait happening, then it was lost. Is there any documentation about BrightScript that explains the technical implementations and semantics of the components? Thanks for the help, Mark.
- Jordan
If you assign the same message port to the roUrlTransfer component that your current screen is using, then you can receive its events within the same Wait loop that you already have running, so you don’t have to block while waiting for the response.
That’s correct, and that’s usually the best way to handle async requests.
Also, an event is not lost if you’re not waiting when it occurs. The event is queued and delivered the next time you wait.
–Mark
“TheEndless” wrote:
If you assign the same message port to the roUrlTransfer component that your current screen is using, then you can receive its events within the same Wait loop that you already have running, so you don’t have to block while waiting for the response.
Congratulations, TheEndless, on your 5,000th post. It looks like you’ve imparted an endless stream of useful information in that time.
