This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/extension / TopicDefinition

TopicDefinition<TWire, TMessage> ​

Definition of a realtime topic, for defineTopic. Meant for SDK packages (the core defines balance/notification; sdk-predictions, those of markets and orders).

Type Parameters ​

TWire ​

TWire

TMessage ​

TMessage

Properties ​

messageType ​

readonly messageType: string

Type of this topic's data messages on the wire, e.g. 'balance_update'.


prefix ​

readonly prefix: string

Topic prefix at the gateway, without the trailing :, e.g. 'balance', 'predictions:orderbook'. The full topic is ${prefix}:${id}.


private ​

readonly private: boolean

true for the user's own topics (balance, notification, predictions:orders): the descriptor takes no id and realtime uses the session's sub. false for public topics (market, predictions:orderbook...), whose descriptor requires the id.


schema ​

readonly schema: WireSchema<TWire, TMessage> | (() => WireSchema<TWire, TMessage>)

Payload schema (see WireSchema), or a function that returns it (e.g. a lazy(...)), so that the schema is only built on the first subscription.


snapshots? ​

readonly optional snapshots?: "deliver" | "ignore"

What to do with the sequenced mode snapshots (single-tenant only): 'deliver' (default) validates and delivers like any message; 'ignore' neither delivers nor reports a validation problem (the topic's seq advances normally and the deltas keep arriving). Use 'ignore' when the gateway's snapshot has a different format from the topic's messages, as in balance (the snapshot is the raw GetBalance protobuf).