Set heartbeat_interval to half of the heartbeat_timeout
Exit the loop if the client wants to disconnect; fixes #30