Thursday 20 April 2017

Should I store html data in memory for future access?

I am using node js with socket.io to stream log file data to the client side. On the server side my node server will be listening on multiple ports and streaming multiple log files (every time a new line is written to the logs, server will stream is to client side).

On the client side I have one .html file and I am using pure javascript (no jquery) to capture these streams of data and displaying it on the frontend.

Does it make sense to store all these log data in memory and (5 separate log files = 5 separate data structure). When the user performs a click event requesting a specific log file data, I will construct the DOM elements to dynamically to display all the data.

Every time the user performs a different click event I am removing all the dom elements and reconstructing the dom with a different set of log data.

In a way, I am trying to mimic a SPA as I only want to keep all my content in a single html file. Is this a valid approach? Are there better approaches?



via shuang

No comments:

Post a Comment