StreamHandler: Stream Handler R6 Class

StreamHandlerR Documentation

Stream Handler R6 Class

Description

Stream Handler R6 Class

Stream Handler R6 Class

Details

Manages streaming responses from Goose

Public fields

process

The processx process object

buffer

Accumulated response buffer

callback

Chunk callback function

error_callback

Error callback function

complete_callback

Completion callback function

max_time

Maximum runtime in seconds (Inf = no limit)

idle_timeout

Maximum time in seconds without output (Inf = no limit) Initialize stream handler

Methods

Public methods


Method new()

Usage
StreamHandler$new(callback, error_callback, complete_callback)
Arguments
callback

Function to call with chunks

error_callback

Function for errors

complete_callback

Function for completion Start streaming process


Method start()

Usage
StreamHandler$start(
  query,
  session_id = NULL,
  max_time = Inf,
  idle_timeout = Inf
)
Arguments
query

The query to execute

session_id

Optional session ID

max_time

Numeric, maximum runtime in seconds (Inf = no limit)

idle_timeout

Numeric, maximum time in seconds without output (Inf = no limit) Monitor streaming process


Method monitor()

Internal loop that reads stdout/stderr, parses chunks, and enforces max_time / idle_timeout. Get accumulated buffer

Usage
StreamHandler$monitor()

Method get_response()

Usage
StreamHandler$get_response()
Returns

Complete response text Stop streaming


Method stop()

Kill the underlying streaming process if it is still running.

Usage
StreamHandler$stop()

Method clone()

The objects of this class are cloneable with this method.

Usage
StreamHandler$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


gooseR documentation built on Feb. 6, 2026, 5:07 p.m.