Asynchronous HTTPSocket and Scope

Assuming an HTTPSocket is subclassed to use events (asynchronous). It’s dimmed locally inside a method each time it wants to Post. Will the socket stay around until it’s disconnected and closed inside it’s events, or will it die when the end of the method is reached?

The best way is to insert a class into the project and set its super to HTTPSocket. Then you drag an instance over the window and this enables you to add the necessary event handlers as easily as you would for any other regular control. The other advantage is that it will stay alive as long as the window is open.

The latter.

Xojo TCPSockets (and subclasses like HTTPSocket) are a special case which do not destruct until/unless disconnected even after going out of scope. Refer to the TCPSocket documentation for more on “orphaned” socket classes.