Integrate the SDK

Events and logging

While a session runs, Speechineer's backend reports what it is doing as a stream of events — progress, warnings and failures alike. They reach your code through the session's onEvent callback (Integrate the SDK › Implementation › Wire up the voice session › onEvent) and are informational: use them for logging or a live status display. Nothing you must react to arrives only here.

The event object

Every event is one object:

type is the stable identifier to branch on — the snake_case signal name from Speechineer's backend. level says how important the event is — debug, info, warning, error or critical — and only info and above are sent to the browser: debug chatter stays on the server. payload carries the details that belong to the type.

Listen for events

Listening is a single option: you pass onEvent where you build the session, next to your other callbacks, and it is called for every event that arrives. The option is the same in every framework, and most integrations use it for one of two things — a debug log during development, or a live status display:

ts
const voice = useSpeechToForm({
  form: intakeForm,
  onEvent: (event) => log.push(`[${event.level}] ${event.type} from ${event.source}`, event.payload),
});

Tip

An event never requires action. The only failures that appear in onEvent are those on Speechineer's backend side — and every error, those included, reaches onError as a typed SpeechineerError. Read errors there, not from events.

Event types

What Speechineer's backend sends today. The type values are stable, but new ones may appear over time — ignore types you don't know.

TypeLevelWhat it tells you
quota_exceededinfoThe session's usage reached its quota budget; the session is stopping gracefully and the usage beyond the budget is denied.
stop_recording_requestedinfoThe stop your page sent was received — Speechineer's backend is winding the recording down.
transcription_downwarningThe speech-recognition connection failed; Speechineer's backend is reopening it in place. The payload counts the attempts (retry_attempt, max_retries).
transcription_send_failwarningAn audio chunk could not be sent; Speechineer's backend reconnects and resends it. Same payload as transcription_down.
llm_extraction_downwarningAn extraction call failed; Speechineer's backend retries it on the latest transcript.
web_socket_kind_unsupportederrorA connection was opened of a kind this workflow does not stream — the payload names the kind.
crasherrorPart of the session failed for good. The same failure reaches onError as a SpeechineerError with recoverable: false — handle it there.