The page uses echarts line chart, how to achieve real-time data refresh?

There is an echarts line chart on the

page, which is required to be refreshed every other minute.
what I"m doing now is to request data every other minute, push into an array of my line chart, and then refresh my line chart.
but this will put a heavy burden on the server, and there will be situations where real-time data is not requested and the line chart is disconnected.
I would like to ask you what good solutions do you have? Can refresh data in less time and solve the server burden.

Apr.21,2021

  1. improve server capacity
  2. use websocket

Polling- polling as you describe has an impact on server load

if you need to refresh ws communications in real time, (websocket) is a good choice

nodeJS-based Socket.IO can be used for compatibility

Menu