Actually we Play a notification sound when some update happens in database, so I am trying to reload a ActionMethod
every 30 seconds when browser in minimized, this works fine in Firefox , but in Chrome this doesn't work.
Scenario:
Minimize the browser and leave the computer idle.
I have tried two methods:
Method 1:
<meta http-equiv="refresh" content="30;URL=http://example.com/" />
Method 2:
<script>
$(document).ready(function () {
setTimeout(function(){
window.location.reload(1);
}, 30000);
});
</script>
After reading this post , It seems when Chrome is minimized it sets Javascript setInterval
and setTimeout
to an idle state, because browser performance improvements affects the executions of Javascript intervals.
So Can i use Scheduled Tasks like FluentScheduler , Quartz.NET or Hangfire to reload a ActionMethod
every 30 seconds ?
Any help would be great.
SignalR is a perfect match here. Why do you want your clients to be sending request to the server every 30 seconds? This is likely to hit your performance and increase your server load.
Instead I would suggest using SignalR and pushing notification to the client whenever there is any update.