class BBS::Windows::Stream

A live stream window: scrollable history + single-line input + poll.

BBS::Windows::Stream.open(app,
  title: ' Live Chat ',
  initial_lines: services[:chat].history.map { |l| fmt(l) },
  placeholder: 'Type a message and press Enter…',
  on_submit: ->(text, app) {
    services[:chat].broadcast(username, text.strip)
  },
  on_poll: ->(app) {
    services[:chat].drain(app.session_id).map { |l| fmt(l) }
  }
)

on_submit(text, app) is called when the user presses Enter on a non-empty input. The input is cleared automatically afterwards unless the handler returns :keep.

on_poll(app) is invoked from the application’s idle tick (~1s). It should return an Array of new lines to append (or nil/[]).