Skip to main content
Version: 11.x

Function: createWSClient()

createWSClient(opts): object

Parameters

ParameterType
optsWebSocketClientOptions

Returns

object

close()

close: () => void

Returns

void

connection

readonly connection: object & object | object | object | null

connectionState

connectionState: BehaviorSubject

reconnect()

reconnect: (cause) => void

Reconnect to the WebSocket server

Parameters

ParameterType
causeError | null

Returns

void

request()

request: (opts) => UnsubscribeFn

Parameters

ParameterType
optsobject
opts.callbacksWSCallbackObserver<AnyRouter, unknown>
opts.lastEventIdstring | undefined
opts.opOperation

Returns

UnsubscribeFn

See

https://trpc.io/docs/v11/client/links/wsLink

Deprecated

🙋‍♂️ Contributors needed to continue supporting WebSockets! See https://github.com/trpc/trpc/issues/6109

Defined in

packages/client/dist/links/wsLink.d.ts:76