Skip to main content
Version: v10.0.0

TrpcSseAdapterOptionsType

Options of the tRPC Server-Sent Events streams, passed as adapterOptions to the Socket . They can be changed per connection attempt with socket.onConnect , e.g. to send a fresh auth token.


Import
import { TrpcSseAdapterOptionsType } from "@hyper-fetch/trpc"

Preview​

type TrpcSseAdapterOptionsType = {
EventSource?: typeof EventSource;
autoConnect?: boolean;
connectionParams?: TrpcConnectionParamsType;
eventSourceInit?: EventSourceInit;
}

Structure​

TrpcSseAdapterOptionsType
NameTypeDescription
EventSource
typeof EventSource

The EventSource class to use, for example from the eventsource package in Node.js. Defaults to the global one (browsers, Bun, Deno).

autoConnect
boolean

Open the streams when the socket is created. Only the first connection depends on it - a socket connected by hand also opens them again when the app goes back online.

connectionParams
TrpcConnectionParamsType

Sent with every stream as the connectionParams query param. The server reads them in createContext as info.connectionParams .

eventSourceInit
EventSourceInit

Passed to the EventSource constructor of every stream, e.g. { withCredentials: true }