Hey guys! Just reviewing GB to see if it’s somethi...
# ask-questions
b
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
Yes, polling is the only way to refresh on the client side.
👍 1
b
Thanks for the quick response!
m
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
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
Oh that’s a great idea of how to integrate it full-circle.
p
@millions-father-50159 I'm interested
👍 1