Hey folks, I'm trying to figure out how real-time...
# sdk-flutter
b
Hey folks, I'm trying to figure out how real-time feature updates are working? how can I subscribe to the stream or listen to the feature changes?
c
Hi @best-rain-36041. Let us check that with team. We will write to you after checking.
Hi @best-rain-36041. GrowthBook supports real-time feature flag updates using Server-Sent Events (SSE). This behavior is controlled via the
backgroundSync
parameter (or
streaming
, depending on the SDK) during SDK initialization. If
backgroundSync
is set to
true
, the SDK automatically establishes an SSE connection to receive updates whenever your feature flags change in the GrowthBook dashboard — no manual refresh needed. If
backgroundSync
is set to
false
, you'll need to call
gb.refreshCache()
manually to fetch the latest feature flags. Currently, the SDK does not expose a way to manually subscribe to the update stream. All logic for real-time updates is handled internally by the SDK.
b
Thanks @calm-dog-24239 for your response. I have enabled
backgroundSync
. Yet I’m not receiving real-time updates when I enable/disable the feature flags. Is there any extra config I need to do?
c
Hi @best-rain-36041 . I’ve got backgroundSync working correctly — feature flags update in real-time when I toggle them in the GrowthBook dashboard. Here’s my current setup for reference: gb = await GBSDKBuilderApp( apiKey: '***', apiHost: 'https://cdn.growthbook.io', attributes: userAttr, backgroundSync: true, growthBookTrackingCallBack: (trackData) {} ).initialize(); If it’s not syncing on your side, could you share how you're initializing the SDK? A full snippet would help spot any difference. Also, which version of the GrowthBook SDK are you using? The backgroundSync logic had some important fixes in the latest release, so it's worth double-checking you're on the latest version. Happy to help debug further!