A proper reconnecting method in the client