Streaming the contents of a log file #120
-
My application has long-running tasks on the server that write information about the process into a log file while they are running. I would like to show the content of those logs "in real-time" to the user on the front-end. My current solution involves a co-routine that periodically reads the content of the log file and then updates a state variable with that content. The issue I have here is that the server will then send the whole content again over the web-socket, even if only one line was written since the last "update". It works, but I would like to optimize this. Is there a way to only send the delta and have the client add that delta to the state variable? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I would create a a vue component on which I can call method to append data to it. But you can still update the server state variable but making sure is not marked dirty (may need new api) so it does not get pushed since you've sent the delta. Hope that make sense? |
Beta Was this translation helpful? Give feedback.
-
trame-xterm can be perfect for that. |
Beta Was this translation helpful? Give feedback.
trame-xterm can be perfect for that.