The solution needs to handle a transient failure in the connection between the client and server.
Proposal
When the websocket connection is lost the server should start a timout and begin capturing the output from the terraform process into a buffer.
If the client reconnects to the server before the timeout occurs the server should first stream the contents of the buffer to the client (catching it up on any missed output) then continue streaming live output from the process.
The solution needs to handle a transient failure in the connection between the client and server.
Proposal
When the websocket connection is lost the server should start a timout and begin capturing the output from the terraform process into a buffer.
If the client reconnects to the server before the timeout occurs the server should first stream the contents of the buffer to the client (catching it up on any missed output) then continue streaming live output from the process.