Creating an Event handler for a roUrlTransfer

I would like to do an asynchronous call to a server. The documentation has the following example to do that, but I am unsure where the HandleUrlEventO() event handler method gets called. The documentation mentions that “a roUrlEvent will be sent to the message port associated with the object”. I assume that is how the HandleUrlEvent() event handler is called but I am unsure how to set up the port to do this. Can anyone assist?

: https://sdkdocs.roku.com/display/sdkdoc/ifUrlTransfer

Function Setup()
    m.pendingXfers = {}
End Function
 
Function GetAsync(url as String)
    newXfer = CreateObject("roUrlTransfer")
    newXfer.SetUrl(url)
    newXfer.AsyncGetToString()
    requestId = newXfer.GetIdentity().ToStr()
    m.pendingXfers[requestId] = newXfer
End Function
 
Function HandleUrlEvent(event as Object)
    requestId = event.GetSourceIdentity().ToStr()
    xfer = m.pendingXfers[requestId]
    if xfer <> invalid then
        ' process it
        m.pendingXfers.Delete(requestId)
    end if
End Function

search these forums, there are some solid examples

Can you provide a quick example?