API reference / @chanx-js/client / core / TopicsControllerOptions
Interface: TopicsControllerOptions<Address, Ref>
Defined in: packages/client/src/core/controller.ts:246
Extends
Omit<ControllerOptions<Address,ChanxMessage>,"on"|"buffer"|"only"|"onUnhandled">
Type Parameters
| Type Parameter | Default type |
|---|---|
Address extends string | - |
Ref extends TopicRef | TopicRef |
Properties
buffer?
optional buffer?: BufferMode;Defined in: packages/client/src/core/controller.ts:255
closeDelay?
optional closeDelay?: number;Defined in: packages/client/src/core/socket.ts:59
Grace period before a socket with no remaining consumers is actually closed. React's StrictMode unmounts and immediately remounts in development, which would otherwise tear down and rebuild the connection on every mount.
Inherited from
enabled?
optional enabled?: boolean;Defined in: packages/client/src/core/controller.ts:32
Inherited from
Omit.enabledheartbeat?
optional heartbeat?: false | HeartbeatOptions;Defined in: packages/client/src/core/socket.ts:50
Ping on an interval and reconnect if nothing comes back. Off unless enabled: chanx consumers only answer ping when they declare a handler for it, and one that does not replies with an error frame every interval. connect() turns it on for channels whose schema declares ping/pong.
Inherited from
maxQueuedFrames?
optional maxQueuedFrames?: number;Defined in: packages/client/src/core/socket.ts:52
Cap on frames buffered while the socket is not yet open.
Inherited from
on?
optional on?: HandlerMap<ToClientOf<Ref>>;Defined in: packages/client/src/core/controller.ts:257
Handlers for the joined topics' messages, keyed by action.
onError?
optional onError?: (error) => void;Defined in: packages/client/src/core/controller.ts:37
Parameters
| Parameter | Type |
|---|---|
error | ChanxErrorFrame |
Returns
void
Inherited from
Omit.onErroronReconnectStop?
optional onReconnectStop?: (attempts) => void;Defined in: packages/client/src/core/socket.ts:43
Parameters
| Parameter | Type |
|---|---|
attempts | number |
Returns
void
Inherited from
onSubscribeError?
optional onSubscribeError?: (topic, error) => void;Defined in: packages/client/src/core/controller.ts:259
Called when a subscription is rejected, typically by an authorization check.
Parameters
| Parameter | Type |
|---|---|
topic | string |
error | unknown |
Returns
void
params?
optional params?: ParamsOf<Address>;Defined in: packages/client/src/core/client.ts:21
Inherited from
Omit.paramsprotocols?
optional protocols?: string | string[];Defined in: packages/client/src/core/socket.ts:30
Inherited from
queryParams?
optional queryParams?: Record<string, string | number>;Defined in: packages/client/src/core/socket.ts:31
Inherited from
reconnectAttempts?
optional reconnectAttempts?: number;Defined in: packages/client/src/core/socket.ts:39
Inherited from
SocketOptions.reconnectAttempts
reconnectInterval?
optional reconnectInterval?: number | ((attempt) => number);Defined in: packages/client/src/core/socket.ts:41
Fixed delay, or a function of the attempt number for backoff.
Inherited from
SocketOptions.reconnectInterval
retryOnError?
optional retryOnError?: boolean;Defined in: packages/client/src/core/socket.ts:42
Inherited from
share?
optional share?: boolean;Defined in: packages/client/src/core/socket.ts:37
Share one socket per resolved URL. connect() defaults it to true for channels that carry topics and false otherwise: topic frames are routed per consumer, but on a plain channel every consumer of a shared socket sees every reply.
Inherited from
shouldReconnect?
optional shouldReconnect?: (event) => boolean;Defined in: packages/client/src/core/socket.ts:38
Parameters
| Parameter | Type |
|---|---|
event | { code?: number; reason?: string; } |
event.code? | number |
event.reason? | string |
Returns
boolean
Inherited from
socketFactory?
optional socketFactory?: SocketFactory;Defined in: packages/client/src/core/socket.ts:53
Inherited from
topics
topics: readonly Ref[];Defined in: packages/client/src/core/controller.ts:254
Topics to join, each from topic.with(params).
validate?
optional validate?: ValidateConfig;Defined in: packages/client/src/core/client.ts:22