How to push feature flag changes to clients right when they happen?

Gergely Sinka
"Not all code paths return a value." - VSThere is a way to stream feature flag and configuration changes to the clients right when they happen. In some cases ConfigCat's pull based architecture does not completely satisfies the requirements when microservices need the latest values instantly, or mobile apps where polling sometimes is a battery consuming anti-pattern.
#
TL;DRYour application subscribes to a PubNub channel to get updates about changes. And use
ConfigCat Webhooks to notify PubNub when a feature flag value gets updated.Sample application in Node.js.#
What do I need?- A free ConfigCat account.
- A PubNub account (there is a free plan). If you don't have, you can keep going with a demo URL:
https://ps.pndsn.com/publish/demo/demo/0/configcat-channel/myCallback/%7B%22CMD%22%3A%22FORCEUPDATE%22%7D
.
#
Connecting your app to ConfigCat- Log in to ConfigCat Dashboard and create a feature flag.
- Connect your application.
- (Optional) You might want to poll ConfigCat for changes anyway but in a longer interval to make sure feature flag values updated even if there is an error delivering notifications.
#
Set up a Webhook to notify PubNub- Add a HTTP GET Webhook using your PubNub URL or use
https://ps.pndsn.com/publish/demo/demo/0/configcat-channel/myCallback/%7B%22CMD%22%3A%22FORCEUPDATE%22%7D
.
#
Subscribe to PubNub messages- Set up your app to subscribe to PubNub messages.
- Make sure a
configCatClient.forceRefresh()
is called to download and update the cache with new feature flag values.
#
Testing- Run your application.
- Update a feature flag value on the ConfigCat Dashboard.