fix ws close and reconnect issue