Skip to main content

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

· 2 min read
Gergely Sinka

There 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.


Your 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.![push-noti](/assets/push-noti.png)

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:

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

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.
Sample application in Node.js.
// PubNub instance
var pubnub = new PubNub({
subscribeKey: pubnubSubscriberKey,
publishKey: pubnubPublishKey,
uuid: "configCat-pubNub-sample"

// Subscribe to the working demo channel
channels: ['configcat-channel']

// Add a listener for PubNub messages
message: function (m) {
var msg = m.message;
if (msg.CMD == "FORCEUPDATE") {
// Downloads the new feature flag values and updates the cache if the message is: { CMD: 'FORCEUPDATE' }
configCatClient.forceRefreshAsync().then(value => {
console.log("Force update message received from PubNub. Updated cache.");


  • Run your application.
  • Update a feature flag value on the ConfigCat Dashboard.