Skip to main content
Version: 11.x

Function: createWSClient()

createWSClient(opts): object

Parameters

ParameterType
optsWebSocketClientOptions

Returns

object

close()

close: () => void

Returns

void

connectionState

connectionState: BehaviorSubject<TRPCConnectionState<TRPCClientError<AnyRouter>>>

reconnect()

reconnect: (cause) => void

Reconnect to the WebSocket server

Parameters

ParameterType
causenull | Error

Returns

void

request()

request: (opts) => UnsubscribeFn

Parameters

ParameterType
optsobject
opts.callbacksWSCallbackObserver<AnyRouter, unknown>
opts.lastEventIdundefined | string
opts.opOperation

Returns

UnsubscribeFn

connection

Get Signature

get connection(): null | Connection

Returns

null | Connection

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/src/links/wsLink.ts:111