add connection thread, add heartbeat thread