Search code examples
javascriptbackground-process

How can website send ajax requests periodically even when the browser is closed


I am getting a twitter account's last tweet with Spring MVC. That is working fine. My purpose is to be get notified via firebase when the last tweet changes (when the new tweet comes). Firebase part is working too. Hence, I need to send ajax requests periodically to the Spring controller. When the website is open, that is fine (thanks to this: https://stackoverflow.com/a/5052661/4250408) but when I close the website, how can it still continues to send requests and do work if the new tweet comes?


Solution

  • you can run a cron job every 5 min