Add auto-reconnect functionality