Classes
Soniox Node SDK — Class Reference
SonioxNodeClient
Soniox Node Client
Example
Constructor
Parameters
| Parameter | Type |
|---|---|
options | SonioxNodeClientOptions |
Returns
SonioxNodeClient
Properties
| Property | Type |
|---|---|
auth | SonioxAuthAPI |
files | SonioxFilesAPI |
models | SonioxModelsAPI |
realtime | SonioxRealtimeApi |
stt | SonioxSttApi |
webhooks | SonioxWebhooksAPI |
SonioxFilesAPI
delete()
Permanently deletes a file. This operation is idempotent - succeeds even if the file doesn't exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | FileIdentifier | The UUID of the file or a SonioxFile instance |
signal? | AbortSignal | Optional AbortSignal for cancellation |
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
delete_all()
Permanently deletes all uploaded files. Iterates through all pages of files and deletes each one.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | DeleteAllFilesOptions | Optional signal and progress callback. |
Returns
Promise<void>
The number of files deleted.
Throws
SonioxHttpError On API errors.
Throws
Error If the operation is aborted via signal.
Example
get()
Retrieve metadata for an uploaded file.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | FileIdentifier | The UUID of the file or a SonioxFile instance |
signal? | AbortSignal | Optional AbortSignal for cancellation |
Returns
Promise<SonioxFile | null>
The file instance, or null if not found
Throws
SonioxHttpError On API errors (except 404)
Example
list()
Retrieves list of uploaded files
The returned result is async iterable - use for await...of
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ListFilesOptions | Optional pagination and cancellation parameters |
Returns
Promise<FileListResult>
FileListResult
Throws
Example
upload()
Uploads a file to Soniox for transcription
Parameters
| Parameter | Type | Description |
|---|---|---|
file | UploadFileInput | Buffer, Uint8Array, Blob, or ReadableStream |
options | UploadFileOptions | Upload options |
Returns
Promise<SonioxFile>
The uploaded file metadata
Throws
SonioxHttpError On API errors
Throws
Error On validation errors (file too large, invalid input)
Examples
SonioxSttApi
create()
Creates a new transcription from audio_url or file_id
Parameters
| Parameter | Type | Description |
|---|---|---|
options | CreateTranscriptionOptions | Transcription options including model and audio source. |
signal? | AbortSignal | - |
Returns
Promise<SonioxTranscription>
The created transcription.
Throws
SonioxHttpError On API errors.
Example
delete()
Permanently deletes a transcription. This operation is idempotent - succeeds even if the transcription doesn't exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | TranscriptionIdentifier | The UUID of the transcription or a SonioxTranscription instance |
signal? | AbortSignal | - |
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
delete_all()
Permanently deletes all transcriptions. Iterates through all pages of transcriptions and deletes each one.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | DeleteAllTranscriptionsOptions | Optional signal. |
Returns
Promise<void>
Throws
SonioxHttpError On API errors.
Throws
Error If the operation is aborted via signal.
Example
destroy()
Permanently deletes a transcription and its associated file (if any). This operation is idempotent - succeeds even if resources don't exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | TranscriptionIdentifier | The UUID of the transcription or a SonioxTranscription instance |
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
destroy_all()
Permanently deletes all transcriptions and their associated files. Iterates through all pages of transcriptions and calls destroy on each one, removing both the transcription and its uploaded file.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | DeleteAllTranscriptionsOptions | Optional signal and progress callback. |
Returns
Promise<void>
The number of transcriptions destroyed.
Throws
SonioxHttpError On API errors.
Throws
Error If the operation is aborted via signal.
Example
get()
Retrieves a transcription by ID
Parameters
| Parameter | Type | Description |
|---|---|---|
id | TranscriptionIdentifier | The UUID of the transcription or a SonioxTranscription instance. |
signal? | AbortSignal | - |
Returns
Promise<SonioxTranscription | null>
The transcription, or null if not found.
Throws
SonioxHttpError On API errors (except 404).
Example
getTranscript()
Retrieves the full transcript text and tokens for a completed transcription. Only available for successfully completed transcriptions.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | TranscriptionIdentifier | The UUID of the transcription or a SonioxTranscription instance |
signal? | AbortSignal | - |
Returns
Promise<SonioxTranscript | null>
The transcript with text and detailed tokens, or null if not found
Throws
SonioxHttpError On API errors (except 404)
Example
list()
Retrieves list of transcriptions
The returned result is async iterable - use for await...of to iterate through all pages
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ListTranscriptionsOptions | Optional pagination and filter parameters. |
signal? | AbortSignal | - |
Returns
Promise<TranscriptionListResult>
TranscriptionListResult with async iteration support.
Throws
SonioxHttpError On API errors.
Example
transcribe()
Unified transcribe method - supports direct file upload
When file is provided, uploads it first then creates a transcription
When wait: true, waits for completion before returning
When cleanup is specified (requires wait: true), cleans up resources after completion or on error/timeout
Parameters
| Parameter | Type | Description |
|---|---|---|
options | TranscribeOptions | Transcribe options including model, audio source, and wait settings. |
Returns
Promise<SonioxTranscription>
The transcription (completed if wait=true, otherwise in queued/processing state).
Throws
SonioxHttpError On API errors.
Throws
Error On validation errors or wait timeout.
Example
transcribeFromFile()
Wrapper to transcribe from raw file data.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | UploadFileInput | Buffer, Uint8Array, Blob, or ReadableStream |
options | TranscribeFromFileOptions | Transcription options (excluding file) |
Returns
Promise<SonioxTranscription>
The transcription (completed if wait=true, otherwise in queued/processing state).
transcribeFromFileId()
Wrapper to transcribe from an uploaded file ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
file_id | string | ID of a previously uploaded file |
options | TranscribeFromFileIdOptions | Transcription options (excluding file_id) |
Returns
Promise<SonioxTranscription>
The transcription (completed if wait=true, otherwise in queued/processing state).
transcribeFromUrl()
Wrapper to transcribe from a URL.
Parameters
| Parameter | Type | Description |
|---|---|---|
audio_url | string | Publicly accessible audio URL |
options | TranscribeFromUrlOptions | Transcription options (excluding audio_url) |
Returns
Promise<SonioxTranscription>
The transcription (completed if wait=true, otherwise in queued/processing state).
wait()
Waits for a transcription to complete
Parameters
| Parameter | Type | Description |
|---|---|---|
id | TranscriptionIdentifier | The UUID of the transcription or a SonioxTranscription instance. |
options? | WaitOptions | Wait options including polling interval, timeout, and callbacks. |
Returns
Promise<SonioxTranscription>
The completed or errored transcription.
Throws
Error If the wait times out or is aborted.
Throws
SonioxHttpError On API errors.
Example
SonioxModelsAPI
list()
List of available models and their attributes.
Parameters
| Parameter | Type | Description |
|---|---|---|
signal? | AbortSignal | Optional AbortSignal for cancellation |
Returns
Promise<SonioxModel[]>
List of available models and their attributes.
See
https://soniox.com/docs/stt/api-reference/models/get_models
SonioxWebhooksAPI
Webhook utilities API accessible via client.webhooks
Provides methods for handling incoming Soniox webhook requests. When used via the client, results include lazy fetch helpers for transcripts.
getAuthFromEnv()
Get webhook authentication configuration from environment variables.
Reads SONIOX_API_WEBHOOK_HEADER and SONIOX_API_WEBHOOK_SECRET environment variables.
Returns undefined if either variable is not set (both are required for authentication).
Returns
WebhookAuthConfig | undefined
handle()
Framework-agnostic webhook handler
Parameters
| Parameter | Type |
|---|---|
options | HandleWebhookOptions |
Returns
handleExpress()
Handle a webhook from an Express-like request
Parameters
| Parameter | Type |
|---|---|
req | ExpressLikeRequest |
auth? | WebhookAuthConfig |
Returns
Example
handleFastify()
Handle a webhook from a Fastify request
Parameters
| Parameter | Type |
|---|---|
req | FastifyLikeRequest |
auth? | WebhookAuthConfig |
Returns
handleHono()
Handle a webhook from a Hono context
Parameters
| Parameter | Type |
|---|---|
c | HonoLikeContext |
auth? | WebhookAuthConfig |
Returns
Promise<WebhookHandlerResultWithFetch>
handleNestJS()
Handle a webhook from a NestJS request
Parameters
| Parameter | Type |
|---|---|
req | NestJSLikeRequest |
auth? | WebhookAuthConfig |
Returns
handleRequest()
Handle a webhook from a Fetch API Request
Parameters
| Parameter | Type |
|---|---|
request | Request |
auth? | WebhookAuthConfig |
Returns
Promise<WebhookHandlerResultWithFetch>
isEvent()
Type guard to check if a value is a valid WebhookEvent
Parameters
| Parameter | Type |
|---|---|
payload | unknown |
Returns
payload is WebhookEvent
parseEvent()
Parse and validate a webhook event payload
Parameters
| Parameter | Type |
|---|---|
payload | unknown |
Returns
verifyAuth()
Verify webhook authentication header
Parameters
| Parameter | Type |
|---|---|
headers | WebhookHeaders |
auth | WebhookAuthConfig |
Returns
boolean
SonioxAuthAPI
createTemporaryKey()
Creates a temporary API key for client-side use.
Parameters
| Parameter | Type | Description |
|---|---|---|
request | TemporaryApiKeyRequest | Request parameters for the temporary key |
signal? | AbortSignal | Optional AbortSignal for cancellation |
Returns
Promise<TemporaryApiKeyResponse>
The temporary API key response
SonioxRealtimeApi
Real-time API factory for creating STT sessions.
Example
stt()
Create a new Speech-to-Text session.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | SttSessionConfig | Session configuration (sent to server) |
options? | SttSessionOptions | Session options (SDK-level settings) |
Returns
New STT session instance
SonioxFile
Uploaded file
Constructor
Parameters
| Parameter | Type |
|---|---|
data | SonioxFileData |
_http | HttpClient |
Returns
SonioxFile
delete()
Permanently deletes this file. This operation is idempotent - succeeds even if the file doesn't exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
signal? | AbortSignal | Optional AbortSignal for cancellation |
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
toJSON()
Returns the raw data for this file.
Returns
Properties
| Property | Type |
|---|---|
client_reference_id | string | undefined |
created_at | string |
filename | string |
id | string |
size | number |
SonioxTranscription
A Transcription instance
Constructor
Parameters
| Parameter | Type |
|---|---|
data | SonioxTranscriptionData |
_http | HttpClient |
transcript? | SonioxTranscript | null |
Returns
SonioxTranscription
delete()
Permanently deletes this transcription. This operation is idempotent - succeeds even if the transcription doesn't exist.
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
destroy()
Permanently deletes this transcription and its associated file (if any). This operation is idempotent - succeeds even if resources don't exist.
Returns
Promise<void>
Throws
SonioxHttpError On API errors (except 404)
Example
getTranscript()
Retrieves the full transcript text and tokens for this transcription. Only available for successfully completed transcriptions.
Returns cached transcript if available (when using transcribe() with wait: true).
Use force: true to bypass the cache and fetch fresh data from the API.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { force?: boolean; signal?: AbortSignal; } | Optional settings |
options.force? | boolean | If true, bypasses cached transcript and fetches from API |
options.signal? | AbortSignal | Optional AbortSignal for request cancellation |
Returns
Promise<SonioxTranscript | null>
The transcript with text and detailed tokens, or null if not found.
Throws
SonioxHttpError On API errors (except 404).
Example
refresh()
Re-fetches this transcription to get the latest status.
Parameters
| Parameter | Type | Description |
|---|---|---|
signal? | AbortSignal | Optional AbortSignal for request cancellation. |
Returns
Promise<SonioxTranscription>
A new SonioxTranscription instance with updated data.
Throws
Example
toJSON()
Returns the raw data for this transcription.
Returns
wait()
Waits for the transcription to complete or fail. Polls the API at the specified interval until the status is 'completed' or 'error'.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | WaitOptions | Wait options including polling interval, timeout, and callbacks. |
Returns
Promise<SonioxTranscription>
The completed or errored transcription.
Throws
Error If the wait times out or is aborted.
Throws
SonioxHttpError On API errors.
Example
Properties
| Property | Type | Description |
|---|---|---|
audio_duration_ms | number | null | undefined | Duration of the audio in milliseconds. Only available after processing begins. |
audio_url | string | null | undefined | URL of the audio file being transcribed. |
client_reference_id | string | null | undefined | Optional tracking identifier. |
context | | TranscriptionContext | null | undefined | Additional context provided for the transcription. |
created_at | string | UTC timestamp when the transcription was created. |
enable_language_identification | boolean | When true, language is detected for each part of the transcription. |
enable_speaker_diarization | boolean | When true, speakers are identified and separated in the transcription output. |
error_message | string | null | undefined | Error message if transcription failed. |
error_type | string | null | undefined | Error type if transcription failed. |
file_id | string | null | undefined | ID of the uploaded file being transcribed. |
filename | string | Name of the file being transcribed. |
id | string | Unique identifier of the transcription. |
language_hints | string[] | undefined | Expected languages in the audio. |
model | string | Speech-to-text model used. |
status | TranscriptionStatus | Current status of the transcription. |
transcript | SonioxTranscript | null | undefined | Pre-fetched transcript. Only available when using transcribe() with wait: true, fetch_transcript !== false, and the transcription completed successfully |
webhook_auth_header_name | string | null | undefined | Name of the authentication header sent with webhook notifications. |
webhook_auth_header_value | string | null | undefined | Authentication header value (masked). |
webhook_status_code | number | null | undefined | HTTP status code received when webhook was delivered. |
webhook_url | string | null | undefined | URL to receive webhook notifications. |
SonioxTranscript
A Transcript result containing the transcribed text and tokens.
Constructor
Parameters
| Parameter | Type |
|---|---|
data | TranscriptResponse |
Returns
SonioxTranscript
segments()
Groups tokens into segments based on specified grouping keys.
A new segment starts when any of the group_by fields changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | SegmentTranscriptOptions | Segmentation options |
Returns
Array of segments with combined text and timing
Example
Properties
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier of the transcription this transcript belongs to. |
text | string | Complete transcribed text content. |
tokens | TranscriptToken[] | List of detailed token information with timestamps and metadata. |
FileListResult
Result set for file listing
Constructor
Parameters
| Parameter | Type | Default value |
|---|---|---|
initialResponse | ListFilesResponse<SonioxFileData> | undefined |
_http | HttpClient | undefined |
_limit | number | undefined | undefined |
_signal | AbortSignal | undefined | undefined |
Returns
FileListResult
[asyncIterator]()
Async iterator that automatically fetches all pages
Use with for await...of to iterate through all files
Returns
AsyncIterator<SonioxFile>
isPaged()
Returns true if there are more pages of results beyond the first page
Returns
boolean
toJSON()
Returns the raw data for this list result. Also used by JSON.stringify() to prevent serialization of internal HTTP client.
Returns
ListFilesResponse<SonioxFileData>
Properties
| Property | Type | Description |
|---|---|---|
files | SonioxFile[] | Files from the first page of results |
next_page_cursor | string | null | Pagination cursor for the next page. Null if no more pages |
TranscriptionListResult
Result set for transcription listing.
Constructor
Parameters
| Parameter | Type |
|---|---|
initialResponse | ListTranscriptionsResponse<SonioxTranscriptionData> |
_http | HttpClient |
_options | ListTranscriptionsOptions |
_signal? | AbortSignal |
Returns
TranscriptionListResult
[asyncIterator]()
Async iterator that automatically fetches all pages.
Use with for await...of to iterate through all transcriptions.
Returns
AsyncIterator<SonioxTranscription>
isPaged()
Returns true if there are more pages of results beyond the first page.
Returns
boolean
toJSON()
Returns the raw data for this list result
Returns
ListTranscriptionsResponse<SonioxTranscriptionData>
Properties
| Property | Type | Description |
|---|---|---|
next_page_cursor | string | null | Pagination cursor for the next page. Null if no more pages. |
transcriptions | SonioxTranscription[] | Transcriptions from the first page of results. |
RealtimeSttSession
Real-time Speech-to-Text session
Provides WebSocket-based streaming transcription with support for:
- Event-based and async iterator consumption
- Pause/resume with automatic keepalive while paused
- AbortSignal cancellation
Example
paused
Whether the session is currently paused.
Returns
boolean
state
Current session state.
Returns
Constructor
Parameters
| Parameter | Type |
|---|---|
apiKey | string |
wsBaseUrl | string |
config | SttSessionConfig |
options? | SttSessionOptions |
Returns
RealtimeSttSession
[asyncIterator]()
Async iterator for consuming events.
Returns
AsyncIterator<RealtimeEvent>
close()
Close (cancel) the session immediately without waiting
Returns
void
connect()
Connect to the Soniox WebSocket API.
Returns
Promise<void>
Throws
AbortError If aborted
Throws
ConnectionError If connection fails
Throws
StateError If already connected
finalize()
Requests the server to finalize current transcription
Parameters
| Parameter | Type |
|---|---|
options? | { trailing_silence_ms?: number; } |
options.trailing_silence_ms? | number |
Returns
void
finish()
Gracefully finish the session
Returns
Promise<void>
keepAlive()
Send a keepalive message
Returns
void
off()
Remove an event handler
Type Parameters
| Type Parameter |
|---|
E extends keyof SttSessionEvents |
Parameters
| Parameter | Type |
|---|---|
event | E |
handler | SttSessionEvents[E] |
Returns
this
on()
Register an event handler
Type Parameters
| Type Parameter |
|---|
E extends keyof SttSessionEvents |
Parameters
| Parameter | Type |
|---|---|
event | E |
handler | SttSessionEvents[E] |
Returns
this
once()
Register a one-time event handler
Type Parameters
| Type Parameter |
|---|
E extends keyof SttSessionEvents |
Parameters
| Parameter | Type |
|---|---|
event | E |
handler | SttSessionEvents[E] |
Returns
this
pause()
Pause audio transmission and starts automatic keepalive messages
Returns
void
resume()
Resume audio transmission
Returns
void
sendAudio()
Send audio data to the server
Parameters
| Parameter | Type | Description |
|---|---|---|
data | AudioData | Audio data as Uint8Array or ArrayBuffer |
Returns
void
Throws
AbortError If aborted
Throws
StateError If not connected
sendStream()
Stream audio data from an async iterable source.
Parameters
| Parameter | Type | Description |
|---|---|---|
stream | AsyncIterable<AudioData> | Async iterable yielding audio chunks |
options? | SendStreamOptions | Optional pacing and auto-finish settings |
Returns
Promise<void>
Throws
AbortError If aborted during streaming
Throws
StateError If not connected
RealtimeSegmentBuffer
Rolling buffer for turning real-time results into stable segments.
size
Number of tokens currently buffered.
Returns
number
Constructor
Parameters
| Parameter | Type |
|---|---|
options? | RealtimeSegmentBufferOptions |
Returns
RealtimeSegmentBuffer
add()
Add a real-time result and return stable segments.
Parameters
| Parameter | Type |
|---|---|
result | RealtimeResult |
Returns
flushAll()
Flush all buffered tokens into segments and clear the buffer.
Includes tokens that are not yet stable by final_audio_proc_ms.
Returns
reset()
Clear all buffered tokens.
Returns
void
RealtimeUtteranceBuffer
Collects real-time results into utterances for endpoint-driven workflows.
Constructor
Parameters
| Parameter | Type |
|---|---|
options? | RealtimeUtteranceBufferOptions |
Returns
RealtimeUtteranceBuffer
addResult()
Add a real-time result and collect stable segments.
Parameters
| Parameter | Type |
|---|---|
result | RealtimeResult |
Returns
markEndpoint()
Mark an endpoint and flush the current utterance.
Returns
RealtimeUtterance | undefined
reset()
Clear buffered segments and tokens.
Returns
void
SonioxError
Extends
Error
Extended by
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
toString()
Creates a human-readable string representation
Returns
string
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | | SonioxErrorCode | string & { } | Error code describing the type of error. Typed as string at the base level to allow subclasses (e.g. HTTP errors) to use their own error code unions. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
SonioxHttpError
HTTP error class for all HTTP-related failures (REST API).
Thrown when HTTP requests fail due to network issues, timeouts, server errors, or response parsing failures.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Overrides
toString()
Creates a human-readable string representation
Returns
string
Overrides
Properties
| Property | Type | Description |
|---|---|---|
bodyText | string | undefined | Response body text, capped at 4KB (only for http_error/parse_error) |
cause | unknown | The underlying error that caused this error, if any. |
code | HttpErrorCode | Categorized HTTP error code |
headers | Record<string, string> | undefined | Response headers (only for http_error) |
method | HttpMethod | HTTP method |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
url | string | Request URL |
RealtimeError
Base error class for all real-time (WebSocket) SDK errors
Extends
Extended by
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Overrides
toString()
Creates a human-readable string representation
Returns
string
Overrides
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
AuthError
Authentication error (401). Thrown when the API key is invalid or expired.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
BadRequestError
Bad request error (400). Thrown for invalid configuration or parameters.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
QuotaError
Quota error (402, 429). Thrown when rate limits are exceeded or quota is exhausted.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
ConnectionError
Connection error. Thrown for WebSocket connection failures and transport errors.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
NetworkError
Network error. Thrown for server-side network issues (408, 500, 503).
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
AbortError
Abort error. Thrown when an operation is cancelled via AbortSignal.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |
StateError
State error. Thrown when an operation is attempted in an invalid state.
Extends
toJSON()
Converts to a plain object for logging/serialization
Returns
Record<string, unknown>
Inherited from
toString()
Creates a human-readable string representation
Returns
string
Inherited from
Properties
| Property | Type | Description |
|---|---|---|
cause | unknown | The underlying error that caused this error, if any. |
code | RealtimeErrorCode | Real-time error code |
raw | unknown | Original response payload for debugging. Contains the raw WebSocket message that caused the error. |
statusCode | number | undefined | HTTP status code when applicable (e.g., 401 for auth errors, 500 for server errors). |