Skip to content

API reference / @chanx-js/client / core / createTopicsController

Function: createTopicsController() ​

ts
function createTopicsController<D, Refs>(
   client, 
   descriptor, 
   initialOptions
): TopicsController<ToServerOf<D>, Refs[number]>;

Defined in: packages/client/src/core/controller.ts:303

Joins a set of topics over one connection.

Subscriptions are reference counted per resolved topic by the connection, so two controllers wanting room:lobby share one subscription. Messages on the channel itself are not topic messages and stay out of this controller's buffer and handlers.

Type Parameters ​

Type ParameterDefault type
D extends ChannelDescriptor<any, any, any, any>-
Refs extends readonly TopicRefOf<D>[]readonly TopicRefOf<D>[]

Parameters ​

ParameterType
clientChanxClient
descriptorD
initialOptionsTopicsControllerOptions<AddressOf<D>, Refs[number]> & object

Returns ​

TopicsController<ToServerOf<D>, Refs[number]>

MIT licensed