in my opinion it's the easiest and most powerful way, is to read the log file of honorbuddy.
just 2 easy desicions to make:
1) Was tehre a change of the logfile in the last 3 Minutes? If not - seems it disconnected - relogg
2) Is there something like "WOW isn't running" - just one of the three standard phrases - if yes relogg.
textfile read could be done very easy in almost every languange. I coded my relogger for HB1 and GB with the usage of the log read. Was not that hard and worked perfect.