To clear channel history, you first need to enable Delete-From-History option on your key set configuration page:
This requires Initialization with secret key.
After that, call
pubnub.deleteMessages
to clear historical messages from a given channel. pubnub.deleteMessages(
{
channel: 'ch1',
start: '15088506076921021',
end: '15088532035597390'
},
(result) => {
console.log(result);
}
);
NOTE: The Delete Messages method behaves slightly differently than other history methods.
The start
parameter is exclusive and the end
parameter is inclusive.
See also: Delete Messages from History