Skip to content
tRPC

Partners

Interface: UseTRPCSubscriptionOptions<TOutput, TError>

On this page

Defined in: packages/react-query/src/shared/hooks/types.ts:227

Options for useSubscription.

See

https://trpc.io/docs/client/react/useSubscription#options

Type Parameters

Type Parameter
TOutput
TError

Properties

enabled?

optional enabled: boolean

Defined in: packages/react-query/src/shared/hooks/types.ts:233

Deprecated

use a skipToken from @tanstack/react-query instead this will be removed in v12


onComplete()?

optional onComplete: () => void

Defined in: packages/react-query/src/shared/hooks/types.ts:249

Called when the subscription is completed on the server

Returns

void


onData()?

optional onData: (data) => void

Defined in: packages/react-query/src/shared/hooks/types.ts:241

Called when new data is received

Parameters

ParameterType
dataTOutput

Returns

void


onError()?

optional onError: (err) => void

Defined in: packages/react-query/src/shared/hooks/types.ts:245

Called when an unrecoverable error occurs and the subscription is closed

Parameters

ParameterType
errTError

Returns

void


onStarted()?

optional onStarted: () => void

Defined in: packages/react-query/src/shared/hooks/types.ts:237

Called when the subscription is started

Returns

void


trpc?

optional trpc: Pick<TRPCRequestOptions, "context">

Defined in: packages/react-query/src/shared/hooks/types.ts:253

tRPC-related options