PubNubStorage & Playback


Parameters

ParameterType / Required / Default Description
channelString / Yes Specifies channel to return history messages from.
reverseBoolean / No / false Setting to true will traverse the time line in reverse starting with the oldest message first. Default is false. If both start and end arguments are provided, reverse is ignored and messages are returned starting with the newest message.
limitNumber / No / 100 Specifies the number of historical messages to return.
startNumber / No Time token delimiting the start of time slice (exclusive) to pull messages from.
endNumber / No Time token delimiting the end of time slice (inclusive) to pull messages from.
includeTimetokenBoolean / No / false If true the message post timestamps will be included in the history response.

Remarks

Simply enabling Storage & Playback add-on for your keys in the PubNub Admin Dashboard will result in all published messages on all channels to be stored. You can prevent a message from being stored by passing the storeInHistory parameter as false when the message is published, like this:

pubnub.publish(
    {
        message: { 
            'price': 8.07
        },
        channel: 'channel1',
        storeInHistory: false // override default storage options
    },
    function (status, response) {
        // log status & response to browser console
        console.log("STATUS  : " + console.log(JSON.stringify(status));
        console.log("RESPONSE: " + console.log(JSON.stringify(response));
    }
);

Otherwise, just omit the storeInHistory or set to true to store the message when it is published.