Streaming in AppKit is a per-network subscription layer that turns provider events into live balance, jetton, and transaction updates for the app.Documentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-feature-fumodocs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Live provider signals
Streaming complements point-in-time API reads. Instead of asking an API client for the latest state after every interaction, the app subscribes to changes for an address on a specific network. TheStreamingManager coordinates providers by chainId. A streaming provider implements one transport for one network, such as a Toncenter or TonAPI websocket stream. Registering another provider for the same network replaces the previous stream for that chain. Provider registration is covered on Providers → How they are registered.
Subscription lifetime
A subscription belongs to the consumer that created it. Balance, jetton, transaction, and combined watches all return an unsubscribe function, and that function is the app’s handle for stopping updates when a component unmounts or a flow ends. When the underlying transport drops and reconnects, the SDK does not replay events from the gap. Updates resume from the provider’s current view of the chain, so any intermediate transitions on a watched address are lost.Before you begin
You need a connected wallet (for the default-addressuseWatch* hooks) and a streaming provider registered on the AppKit instance. See Providers → How they are registered.
Watch from React
Mount watch hooks near the part of the tree that needs live data. The hook keeps related query caches fresh while it is mounted; passingonChange adds a side-effect callback on top of the cache refresh. Every React watch hook accepts an optional { onChange?, network? }, and the *ByAddress variants additionally accept an address.
Mount as many watchers as you need. The SDK deduplicates subscribers by network, address, and type, so multiple hook instances watching the same data share one underlying socket subscription. There is no benefit to lifting watchers into a single root component just to share them — pull them into the component that actually needs the live value.
Watch a balance
useWatchBalance refreshes the cache that useBalance reads. useBalance is a TanStack Query result ({ data, isLoading, isError, refetch, ... }); data is the formatted TON balance as a string when present.
Watch transactions
useWatchTransactions reacts to transaction lifecycle changes. The update payload exposes traceHash and status ('pending' | 'confirmed' | 'finalized' | 'invalidated'). Plug in your own notification or state-update logic; the SDK does not pick a UI primitive for you.
Watch by address
For receipt screens, admin tooling, or order-tracking widgets, subscribe to an address that may not be the connected wallet. The*ByAddress hooks take an address and keep the matching useBalanceByAddress / cache fresh while also delivering each update to onChange.
Watch jettons
useWatchJettons pushes jetton balance changes for the connected wallet. Each update covers one jetton (masterAddress, walletAddress, ownerAddress, rawBalance) and may include decimals and a formatted balance when the jetton’s decimals are known.
From vanilla code
A non-React consumer keeps the unsubscribe function returned by eachwatch* action and calls it when the screen or process no longer needs updates.
watchBalanceByAddress, watchJettons, watchJettonsByAddress, watchTransactions, and watchTransactionsByAddress. Each takes { network?, onChange } (and address on the *ByAddress variants) and returns an unsubscribe function.
Connection state
Connection state describes transport health, not chain finality. A websocket can disconnect and reconnect while the underlying account state continues to change. After reconnect, updates may resume from the provider’s current view of the chain. A flow that needs certainty should refresh from the configured API client before it changes product state.appKit.streamingManager.onConnectionChange(network, callback) registers a listener for the WebSocket connection state of one network. The callback receives connected: boolean; the method returns an unsubscribe function. Pair it with useNetwork so the listener follows the currently selected network.
Tips
- Store every unsubscribe function and call it when the consumer goes away.
- Call
hasStreamingProviderbefore subscribing on a network that may not have a provider registered, and degrade gracefully when it returnsfalse. - Treat streaming updates as best-effort UI refresh signals. Reconcile with a point-in-time read before changing product state that depends on correctness.
update.statuscarries one of'pending' | 'confirmed' | 'finalized' | 'invalidated'on every streaming payload. Only'finalized'is irreversible; treat the others as intermediate.