title: JS Event Listener check on PHP session infinitely
body: <p>I want my page to consistently check if the user session is still active.
  if using event listener. My concern is that php file execution time is limited. is there way to set php execution to infinite? or is there a better way of doing this?</p>
  
  <p>JS:</p>
  
  <pre><code>$(document).ready(function() {
      var loginSource = new EventSource("/structure/ajax/check_login_session.php");
  
      loginSource.addEventListener("login-verification", function(e) {
          var response = JSON.parse(e.data);
          if (data.login_failed) {
              login_fail_redirect();
          }
      });
  })
  </code></pre>
  
  <p>php</p>
  
  <pre><code>function send_response() {
  
      if (empty($_SESSION['user_info']) || empty($_SESSION['user_info']['active'])) {
  
          $response = array("status" =&gt; "failed", "login_failed" =&gt; 1);
  
      } else {
  
          $response = array("status" =&gt; "success", "login_failed" =&gt; 0);
  
      }
  
      echo "event: login-verification\n";
      echo 'data: '.json_encode($response);
      echo "\n\n";
      flush();
  
  }
  while (true) {
      send_response();
      sleep(2);
  }
  </code></pre>