This may not be the right way to do this (not a console developer), but some time ago I did a terminal animation in Go that I ran on my Android phone. This is done by cleaning the screen, drawing, cleaning, etc.
I donβt remember what I used to clear the screen, but for example, I just tried this, fmt.Print("\033[2J") and it seems to work. Caution should be exercised here. Support for escape sequences to clear the screen may differ for the platform and even the terminal emulator.
But keeping in mind, you could keep a buffer of what the client should look like when a message is received, clear the screen, and then change and retype the buffer.
source share