powerful-hospital-68427
11/25/2024, 9:02 PMorange-terabyte-33302
11/25/2024, 9:02 PMorange-terabyte-33302
11/25/2024, 9:03 PMautoRefresh: true
when calling loadFeatures()
. This requires using the GrowthBook Proxy for self-hosted instances [GrowthBook Proxy](https://docs.growthbook.io/self-host/proxy). 2. If you're not using streaming updates, you can manually refresh features by calling gb.refreshFeatures()
. This allows you to implement your own polling behavior or trigger updates on specific user actions [Forum Conversation](https://linen.growthbook.io/t/10118731/what-s-the-recommended-approach-to-trigger-a-refetch-of-feat). 3. For server-side implementations (e.g., Node.js), you may need to set up polyfills for EventSource to enable streaming updates: javascript const { setPolyfills } = require("@growthbook/growthbook"); setPolyfills({ fetch: require("cross-fetch"), EventSource: require("eventsource"), });
[Forum Conversation](https://linen.growthbook.io/t/16601438/hi-i-am-trying-to-use-growthbook-in-nodejs-but-cannot-make-a) 4. If you're using the Java SDK, you can use the GBFeaturesRepository
class to manage feature refreshing. You can configure the TTL (Time To Live) for cached features [Forum Conversation](https://linen.growthbook.io/t/10113860/hi-i-am-exploring-growthbook-java-sdk-i-have-a-very-basic-qu). 5. For other SDKs that don't support streaming updates, you might need to implement your own polling mechanism by periodically calling loadFeatures()
or a similar method depending on the SDK you're using. If none of these options work for your specific setup, you may need to provide more details about your implementation to get more targeted advice.powerful-hospital-68427
11/25/2024, 9:08 PMpowerful-hospital-68427
11/25/2024, 9:09 PMorange-terabyte-33302
11/25/2024, 9:09 PMorange-terabyte-33302
11/25/2024, 9:09 PMreact-native-sse
library: bash npm install --save react-native-sse
2. Then, you need to configure GrowthBook to use this polyfill: javascript import { setPolyfills } from "@growthbook/growthbook"; import EventSource from "react-native-sse"; // Configure GrowthBook to use the eventsource library setPolyfills({ EventSource: EventSource });
3. After setting up the polyfill, you can enable streaming updates by passing streaming: true
when initializing GrowthBook: javascript gb.init({ streaming: true, // Other options... })
This setup should allow your React Native app to receive real-time updates from GrowthBook without the need for manual polling. If you're still experiencing issues with refreshing or calling the API, you can manually refresh features by calling gb.refreshFeatures()
at specific points in your app lifecycle or on user actions. For more details, you can refer to the [React Native Streaming Updates documentation](https://docs.growthbook.io/lib/react-native#streaming-updates). Remember that streaming updates are only supported on GrowthBook Cloud or if you're running a GrowthBook Proxy Server. If you're self-hosting GrowthBook, make sure you have the proxy set up correctly.