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

Reference / @getenginex/sdk/realtime / coreTopics

coreTopics ​

const coreTopics: object

Core realtime topics, for realtime.subscribe. Both are private: they use the session's user and require login.

Type Declaration ​

balance() ​

balance(): Topic<BalanceUpdate>

Updates to the user's balance (balance:<sub>, balance_update messages). The sequenced mode snapshot is not delivered: load the balance with wallet.getBalance() when subscribing and in onResync.

Returns ​

Topic<BalanceUpdate>

Example ​

ts
realtime.subscribe(coreTopics.balance(), ({ available, changeType }) => console.log(available, changeType))

notification() ​

notification(): Topic<RealtimeNotification>

User notifications (notification:<sub>).

Returns ​

Topic<RealtimeNotification>

Example ​

ts
realtime.subscribe(coreTopics.notification(), (n) => toast(n.title, n.message))

Example ​

ts
import { createRealtime, coreTopics } from '@getenginex/sdk/realtime'

const realtime = createRealtime(enginex)
const off = realtime.subscribe(coreTopics.balance(), (update) => render(update.available))