Subscription Status

The PubNub Redux framework provides listeners that monitor PubNub Subscription Status Events, and reducers that dispatch actions to update the store when operations are unsuccessful. Your application should respond to these actions to display an error message to the user and to optionally retry the operation.

State Shape

The data about Subscriptions is stored ... The following example shows the shape of...

{
byId: {

}
}
}

Reducers

The PubNub Redux framework provides reducers your app can implement that respond to various actions that update the store. To track the state of a set of objects in the store, combine the reducers you want into the rootReducer for your app.

createSubscriptionStatusReducer

createSubscriptionStatusReducer instantiates a reducer in the store that responds to actions dispatched to update the state in the store when the listener receives a Subscription Status event.

createSubscriptionStatusReducer();

Listeners

The PubNub Redux framework includes listeners that monitor PubNub events from the server and dispatch corresponding actions. All listeners are automatically invoked if your app registers the combined PubNub listener. You can register only specific listeners, or implement your own combine listeners function.

createSubscriptionStatusListener

createSubscriptionStatusListener registers a listener in the store that monitors Subscription Status events.

A sample implementation of a single listener:

pubnub.addListener(createSubscriptionStatusListener(store.dispatch));

Commands

The PubNub Redux framework doesn't contain any built-in commands to dispatch a subscription status event action.

Reference

You can find more information about the specific event messages in the Publish & Subscribe API Reference for Real-time Apps (PubNub API reference).

Last updated on