public function setCookie($cookie) {
    //TODO: add error control when the cookie array is not valid
    if (isset($cookie["expires"])) {
      $cookie["expires"] = intval($cookie["expires"]) * 1000;
    }
    $cookie['value'] = urlencode($cookie['value']);
    return $this->command('set_cookie', $cookie);
  }