onStdout, onStderr callbacks to the commands.run() method in JavaScript
or the on_stdout, on_stderr callbacks to the commands.run() method in Python.
The SDK asks the sandbox for a keepalive ping every 50 seconds on every stream, so a stream normally stays open for more than an hour even while nothing is written. No single connection is guaranteed that long, so build your client to reconnect. See Stream connections.