The community forums are in BETA and closed to the public.

Create Channel with 5 minutes of storage capability

Hi ,

I want to send some specific type of messages to a channel that should not remain stored for more than 5 minutes where as rest of the messages should be remained stored for the maximum supported time. Is there any way to achieve that e.g. by doing ttl = 300000;// ms publish(channel_name, msg, ttl ) // this msg with die in 5 minutes;

Is it possible to achieve that? If not, then as an alternative is it possible to create a channel that stores every msg for 5 minutes.

Thanks Gaurav

Hi Guarav, this isn't currently supported though our product team has been informed of your request to specify storage TTL per publish.

As Dannel stated, we don't have a per channel TTL. Every channel has the same storage duration that is configured in your PubNub Account Dashboard. You can publish with doNotStore flag set to true to not store it at all and pull the message from the channel message cache queue but that cache is not predictable. It can remain cache from 5 to 20 minutes and if there are lots of messages it can get pushed off the size 100 message queue.

Best alternative is:

  • publish with doNotStore = true (param name varies with each SDK)
  • on publish success, store this message in your database (POST to a REST endpoint on your server)
  • have a server background process that runs once a minute to delete expired messages from your database

Hope that is helpful.


Comments to this discussion are now closed!