I don't see why you need an input box to pop up when the sock closes. It will close regardless. If I want to have it automatically reconnect I have a switch for reconnect. If switch is true it will reconnect, otherwise it wont.

For messages there is the $tip function that works nicely. Or you can create a dialog for messages.