Single-page applications that support client and server synchronization

I am trying to understand how the spa works for individual pages.

My understanding of the spa is that you load data at startup, and you use ajax calls to save, etc., and the whole idea is that your models cache data on the client so that you have a rich instant experience in your browser.

I am confused about how the client stays in sync with the server. EG. If I have several users who have logged into my spa and they all make changes, how does my client know that another user has updated their face data if they use cached data?

I suppose something like this should happen on the server side in order to update the client when changing. Does this exist or I don’t understand something?

Any help or pointers to additional information would be greatly appreciated.

Thanks in advance.

+4
source share
1 answer

For communication between the server and the client, you can use SignalR.

SignalR allows you to create a hub on the server that you can report to update clients.

It works with a backup mechanism, it tries to use the following methods and returns to the next if it is not available in the browser:

  • Web sockets
  • server sent events
  • forever
  • long survey

Link for backups: http://www.asp.net/signalr/overview/introduction/transports-and-fallbacks

Link for signal: http://signalr.net/

+2
source

Source: https://habr.com/ru/post/1479712/


All Articles