即使浏览器关闭,网站如何定期发送ajax请求

时间:2022-09-24 23:53:05

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://*.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?

我正在使用Spring MVC获得Twitter帐户的最后一条推文。这工作正常。我的目的是在最后一条推文发生变化时(当新推文发布时)通过firebase获得通知。 Firebase部分也在运作。因此,我需要定期向Spring控制器发送ajax请求。当网站开放时,这很好(感谢:https://*.com/a/5052661/4250408)但是当我关闭网站时,如果新的推文仍然可以继续发送请求并继续工作来?

1 个解决方案

#1


1  

you can run a cron job every 5 min

你可以每5分钟完成一次cron工作

#1


1  

you can run a cron job every 5 min

你可以每5分钟完成一次cron工作