PubNub caches up to 100 published messages in-memory. When a new client subscribes, it will by default only deliver messages that occur after the subscribe happens, even if there are existing messages in the cache. You can retrieve in-memory cached messages for a new connection by subscribing with an older timetoken, typically for up to 5 minutes from the time messages were published.
However, historical message durability depends on the memory management status of the cluster you connect to. To guarantee access to historical messages, enable the Storage add-on and use the history API which lets you retrieve messages for up to 30 days on any channel or even unlimited retention.