I am developing a web application that includes a "facebook like" notification feature (not web push notification). I want that the notifications will be updated every few seconds.
I understand the different between the regular Ajax call that the client will make every few seconds to the server and WebSocket \ SignalR that will establish a connection that will remain open(?) and the server will push the data to the client when its needed so the client will not need to make a new HTTP call every few seconds also when its not needed.
So what I am asking?
Let's say that my site will serve lots of clients and I'm OK with that the data of the notifications will be refreshed with a delay of a few seconds. real-time is not needed here.
I am wondering if it's still better to use WebSocket (SignalR) and as a side effect the server will need to manage so many open connections that will consume lots of memory and CPU resources for some clients that may need to receive notifications. As per my understanding, SignalR \ Websockets are persistence.
OR
Maybe it's better to make an Ajax call every few seconds to check if there is updated data. in that way, the server will not need to manage all the connections all the time and only the connections of some clients every few seconds.
I am also wondering if there is a limitation or a bad side effect when using SignalR \ WebSocket in terms of the number of the live connections.