The handler function type inferred from a SubscriptionBuilder.
SubscriptionBuilder
Must be an async generator that yields outgoing events. When the endpoint has injected services, the handler receives a second services argument.
services
const handler: SubscriptionHandler<typeof chatEndpoint> = async function* ({ incoming, principal }) { yield tracked('welcome', { text: 'Hello!' }); for await (const msg of incoming) { yield { text: `${principal.name}: ${msg.text}` }; } }; Copy
const handler: SubscriptionHandler<typeof chatEndpoint> = async function* ({ incoming, principal }) { yield tracked('welcome', { text: 'Hello!' }); for await (const msg of incoming) { yield { text: `${principal.name}: ${msg.text}` }; } };
The handler function type inferred from a
SubscriptionBuilder.Must be an async generator that yields outgoing events. When the endpoint has injected services, the handler receives a second
servicesargument.