Add auto-reconnecting for socket disconnections.