Integrate the SDK

Events and logging

While a session runs, Speechineer reports what it is doing as a stream of events — progress and warnings. 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.

Anything that ends the session is not an event. It reaches you as a typed error through onError and state.error instead, so you never have to read an event to find out whether the session is still alive — see Integrate the SDK › Errors.

The event object

Every event is one object:

event is the stable identifier to branch on. level says how important it is — debug, info, warning, error or critical — and only info and above reach the browser: debug chatter stays behind. data carries the details belonging to that event.

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.event} from ${event.source}`, event.data),
});

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 sends today. The event values are stable, but new ones may appear over time — ignore types you don't know.

TypeLevelWhat it tells you
stop_recording_requestedinfoThe stop your page sent was received — the recording is winding down.
transcription_downwarningThe speech-recognition connection failed and is being reopened in place. data counts the attempts (retry_attempt, max_retries).
transcription_send_failwarningAn audio chunk could not be sent; it is resent after reconnecting. Same data as transcription_down.
llm_extraction_downwarningAn extraction call failed and is being retried on the latest transcript.
web_socket_kind_unsupportedwarningA connection was opened that this capability does not use — data names which. The connection itself is closed with 4422; the session keeps running.
http_precondition_unmetwarningAn action was called before its prerequisite happened. The call itself is answered 409; this is the notification.