Skip to content

API reference / @chanx-js/server / core / consumer

Function: consumer() ​

ts
function consumer<Path, State, User, Emits>(path, options): ConsumerBuilder<Path, State, User, MessageOf<Emits>>;

Defined in: packages/server/src/consumer.ts:314

Declare a consumer: a route and the messages it handles.

Type Parameters ​

Type ParameterDefault type
Path extends string-
StateRecord<never, never>
Userundefined
Emits extends AnyMessageDefinitionnever

Parameters ​

ParameterType
pathPath
optionsConsumerOptions<Path, State, User, Emits>

Returns ​

ConsumerBuilder<Path, State, User, MessageOf<Emits>>

MIT licensed