Added automatic reconnection for clients.