Added reconnect logic when it is disconnected from the chat server