https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
b

blue-ghost-765

04/21/2022, 11:04 PM
Hey guys! Just reviewing GB to see if it’s something I’d be interested in adopting for feature flags. I have looked in the js and react sdk and haven’t found a way to “subscribe” or “refresh” the current state of features. Is this something we would have to roll on our own using polling? I played with the webhook feature and that works great if your features only exist in a single service with an webhook endpoint but nothing for other services or react. Any ideas or nudges in the right direction would be greatly appreciated. If polling would be the only way, please let me know there as well.
f

future-teacher-7046

04/21/2022, 11:05 PM
Yes, polling is the only way to refresh on the client side.
👍 1
b

blue-ghost-765

04/21/2022, 11:06 PM
Thanks for the quick response!
m

millions-father-50159

04/22/2022, 3:21 PM
I might do a write up after I finish it up, but I was able to POC something using AWS API Gateway (WebSockets), a few lambda functions and DynamoDB that pushed feature flag updates to a dummy website I built to test this out. The idea/architecture was roughly based off this https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/ The main difference being that instead of having a lambda function that received messages from the WebSocket and sent them to all connected clients there was a lambda that received
POST
requests from GrowthBook and pushed the updates to all connected clients. Haven’t integrated it into our web-app quite yet, but I don’t see a reason why it wouldn’t work.
f

future-teacher-7046

04/22/2022, 4:04 PM
Awesome! A writeup would be cool. I could also see making a small SDK wrapper you could use like this:
Copy code
const growthbook = new GrowthBook(...);

syncFeatures(growthbook, {
  endpoint: "https://..."
});
👀 1
m

millions-father-50159

04/22/2022, 4:55 PM
Oh that’s a great idea of how to integrate it full-circle.
p

prehistoric-waitress-6977

05/06/2022, 2:55 PM
@millions-father-50159 I'm interested
👍 1
20 Views