Implemented the keepalive in the client