P
P
password222022-01-05 00:45:02
JavaScript
password22, 2022-01-05 00:45:02

How to update data while client is on another tab via SignalR?

Good evening! I have such a system on my site that if a client is connected to the site through a js client using SignalR, then it is updated exactly every 2 minutes and new data arrives.

But the fact is that when the client leaves the tab and then returns back (for example, after 10 minutes), the missing data is not received. How to make them come as soon as the client returns to the tab?

Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MrColdCoffee, 2022-01-09
@password22

Hey!
window.onfocus - the event when the user returns to this tab

window.addEventListener("focus", function(){
// Тут делай что нужно
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question