I want to use SSE(Server sent events) to send real time notifications to my app users.
I still in the planning phase in which I'm choosing between SSE/Web socket protocol.
From what I read, I see that the Ideal for my case is to SSE (Please advice if more).
About how SEE works, this is the workflow conclusion of what I understood :
"Client (browser) sends a request to the server via HTTP. It creates a process, which fetches latest state in the DB and responds back. Client gets server response and in N seconds sends next request to the server."
The problem I'm thinking about is that the server will start a loop which checks for something that need to be notified , doesn't this mean that the server will not stop execution of the file containing this loop until he closes his browser ? Suppose my web app needs to be opened 8 hours per days, so for each user of the system, the file will still be executed for these 8 hours. and consume computer resources.
Is not his a heavy load on the server ? or there is some play-around fro this point?
Appreciating any help,