i am getting starting with Roku development and after playing around with examples and reading through the docs, forums etc i've noticed that there is no app close/exit event handling through app code or handling the Home button etc...
With that in mind i have the following situation:
I start a component Task that opens a TCP socket/connection and listens for some custom commands i send. The Task of course runs in a loop waiting and reading the data as it comes through the socket, updates the app UI and so on... (similar to this example https://sdkdocs.roku.com/display/sdkdoc/roStreamSocket just without allowing multiple connections)
How am i supposed to handle closing the TCP socket/port if i am unable to catch the app/exit close events?
Should i even worry about that on the Roku/BrightScript side, are the sockets automatically closed and Tasks stopped? (i've noticed that the rerunning the app after pressing Home successfully opens the socket connection on the same port so i guess that it got closed properly, but still it kinda feels wrong without any code handling :))
I've seen on this example https://sdkdocs.roku.com/display/sdkdoc/roDataGramSocket that it says :
udp.close() ' would happen automatically as udp goes out of scope
Which leads me to believe that the closing happens automatically when the app closes. (as with some tests i implemented)
Am i getting this right? :) Is so all i need to do is implement some ping/pong events for the client side to be able to detect that the Roku app socket got closed.
Yes, tasks are getting stopped and sockets closed on app exit, memory is released etc. There is a tear-down/cleanup happening