def handle_control_command(command)
      exit_reason = nil
      if command.cancel_signal?
        UI.verbose("received cancel signal shutting down, reason: #{command.reason}")

        # send an ack to the client to let it know we're shutting down
        cancel_response = '{"payload":{"status":"cancelled"}}'
        send_response(cancel_response)

        exit_reason = :cancelled
      elsif command.done_signal?
        UI.verbose("received done signal shutting down")

        # client is already in the process of shutting down, no need to ack
        exit_reason = :done
      end

      # if the command came in with a user-facing message, display it
      if command.user_message
        UI.important(command.user_message)
      end

      # currently all control commands should trigger a disconnect and shutdown
      handle_disconnect(error: false, exit_reason: exit_reason)
      return COMMAND_EXECUTION_STATE[:already_shutdown]
    end
def handle_control_command(command)
      exit_reason = nil
      if command.cancel_signal?
        UI.verbose("received cancel signal shutting down, reason: #{command.reason}")

        # send an ack to the client to let it know we're shutting down
        cancel_response = '{"payload":{"status":"cancelled"}}'
        send_response(cancel_response)

        exit_reason = :cancelled
      elsif command.done_signal?
        UI.verbose("received done signal shutting down")

        # client is already in the process of shutting down, no need to ack
        exit_reason = :done
      end

      # if the command came in with a user-facing message, display it
      if command.user_message
        UI.important(command.user_message)
      end

      # currently all control commands should trigger a disconnect and shutdown
      handle_disconnect(error: false, exit_reason: exit_reason)
      return COMMAND_EXECUTION_STATE[:already_shutdown]
    end
we got a server control command from the client to do something like shutdown