Skip to content
tRPC

Partners

Function: tracked()

On this page

tracked<TData>(id, data): TrackedEnvelope<TData>

Defined in: packages/server/src/unstable-core-do-not-import/stream/tracked.ts:46

Gives a subscription event an id. When the connection drops, the client reconnects with the last id it got, as input.lastEventId, so the subscription can resume from there. The id can't be empty.

Type Parameters

Type Parameter
TData

Parameters

ParameterType
idstring
dataTData

Returns

TrackedEnvelope<TData>

Example

yield tracked(post.id, post);

See

https://trpc.io/docs/server/subscriptions#tracked