Q: Websockets, SSE, or HTTP when auto updating a constantly open dashboard page My app is built in Angular (2+) and NodeJS. One of the pages is basically a dashboard that shows current tasks of a company, where this dashboard is shown all day on a TV to the companies staff. 


*

*Rarely is it refreshed or reloaded manually. 

*Tasks are updated every 5-10 mins by a staff member from another computer.

*Tasks on dashboard need to be updated asap after any task is updated.

*App should limit data transfer when updating dashboard, after task update.


I initially tried websockets but had a problem with connection reliability as sometimes the board would never get updated because the websocket would lose its connection. I could never figure this problem out and read that websockets can be unreliable.
Currently I'm just running an http call every 15 seconds to retrieve a new set of data from the backend. But this can be costly with data transfer as the app scales.
I've just recently heard about SSE but know nothing about it.
At the moment my next plan is to set up a "last updated" status check where I still run an http call every 15 seconds, passing a "last updated" time from the frontend and comparing that to the backends "last updated" time (which is updated whenever a task is changed) and only returning data if the frontend's time is outdated, to reduce data transfer.
Does that sounds like a good idea, or should I try websockets again, or SSE?

A: 
I initially tried websockets but had a problem with connection reliability as sometimes the board would never get updated because the websocket would lose its connection.

Handle the event for when the connection is lost and reconnect it.

I could never figure this problem out and read that websockets can be unreliable.

Don't let some random nonsense you read on the internet keep you from owning the problem and figuring it out.  Web Sockets are reliable as anything else.  And, like anything else, they can get disconnected.  And, like many of the newer APIs, they leave re-connection logic up to you... the app developer.  If you simply don't want to deal with it, there are many packages on NPM for auto-reconnecting Web Sockets which do exactly I suggested.  They handle the events for disconnection, and immediately reconnect.

Currently I'm just running an http call every 15 seconds to retrieve a new set of data from the backend. But this can be costly with data transfer as the app scales.

It can be, yes.

I've just recently heard about SSE but know nothing about it.

From what little we know about your problem, SSE sounds like the right way to go.  SSE is best for:


*

*Evented data

*Data that can be somehow serialized to text (JSON is fine, but don't base64 encode large binary streams as you'll make them too big)

*Unidirectional messages, from server to client


Most implementations will reconnect for you, and it even supports a method of picking up where it left off, if a disconnection actually occurs.

A: If you need to push only data from the server to the client, it may worth having a look at Server-Sent Events.
You can have a look at this article (https://streamdata.io/blog/push-sse-vs-websockets/) and this video (https://www.youtube.com/watch?v=NDDp7BiSad4) to get an insight about this technology and whether it could fit your needs. They summarize pros & cons of both SSE and WebSockets.
