Network Status

Network status is an indicator of the client's connection to the network. Knowledge of network status is crucial to building applications which can operate offline or which manage their battery consumption.

Sometimes, the PubNub SDK even provides more accurate network status information than the host platform APIs.

The Redux components described in this section manage the knowledge of whether the client is considered connected.

State Shape

Network status is monitored using the Boolean isConnected property of the networkStatus object. When isConnected is true, the application is considered to be online.

The following example shows the shape of Network Status data in the store:

"networkStatus": {
"isConnected": true


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.


createNetworkStatusReducer instantiates a reducer in the store that responds to actions dispatched to update the state of network status in the store.


createNetworkStatusReducer Arguments

initializerbooleanNofalseUsually, you initialize this reducer with a value of false. The listener invokes the reducer with either true or false based on the network status connection.


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.


The createNetworkStatusListener registers a listener in the store that monitors network status events.

A sample implementation of a single listener:



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

Last updated on