如何在一段时间后显示Web推送通知

I would know how to make a timeout in function a specific $_SESSION['element'] The goal is to display an information via web push notification. If the customer come back after 48hr, the notification is displayed.

Currently when $_SESSION['SpecialsProducts'] is declared, the information is not displayed.

Tk.

My code

    if (WEB_PUSH_SPECIAL == 'True') {
            $special_products = $this->specialsProducts();

            if (!empty($special_products) && $_SESSION['SpecialsProducts'] === false) {
              $_SESSION['SpecialsProducts'] = true;

              $message_products_special = $special_products;
              $special_link = CLICSHOPPING::link(null, 'Products&Specials');
              $message_products_special = json_encode($message_products_special);
              $special_link = json_encode($special_link);

              $output .= <<< JS
    <script>
    /* Begin PHP values */
    var introduction = $introduction;
    var message_products_special = $message_products_special;
    var special_link = $special_link;
    /* End PHP values */

    Push.create(introduction, {
        body: message_products_special,
        icon: 'sources/images/logos/others/favicon.png',
        timeout: 8000, 
        vibrate: [100, 100, 100], 
        onClick: function() {
            window.location = special_link;
        }
    });
    </script>
    JS;
            }
          }

   echo  $output;

the function

   public function specialsProducts() {
      $this->db = Registry::get('Db');

      if ($_SESSION['SpecialsProducts'] === false) {
        $Qspecials = $$this->db->prepare('select count(specials_id) as count
                                                from :table_specials
                                                where status = 1
                                              ');

        $Qspecials->execute();

        if ($Qspecials->valueInt('count') > 0) {
          $message = $this->getDef('module_web_push_text_specials');
        }
      }

      Return $message;
    }