Reputation: 11
I have this scenario:
one client:
var c = PUBNUB.init({
publish_key : 'p_key',
subscribe_key: 'sub_key',
uuid:'my_client'
});
two channels: ch1 and ch2
in backend with php i publish messages to ch1 and ch2.
the client subscribe to ch1 and receive message after that the client unsubscribe from ch1 and subscribe to ch2.
the backend still publish messages to ch1 (unsubscribed on);
client re subscribe to ch1 again and receive all the messages published on ch1 when client was unsubscribed.
I don't want to receive those messages because a message is an event to reload the page. Is there a way to cover this scenario?
Upvotes: 1
Views: 90
Reputation: 7649
Currently, the default behavior of the pubnub javascript SDK is that it will store a savepoint in localstore for messages every time a subscribe happens. If a client unsubscribes and resubscribes, that savepoint will be used to pick up where the client last left off. The 'restore' argument can be set to false and passed in as per https://github.com/pubnub/javascript/blob/master/core/src/pubnub-common.js#L1081
Upvotes: 1