By default, PubNub does not store data transmitted through its realtime network. PubNub has an optional add-on called Message Persistence that stores all published messages automatically for a preconfigured period of time: from 1 up to 30 days, and Unlimited. Stored messages can be retrieved via a history
API.
PubNub is equipped with AES-256 encryption (used and approved by the US Government) which is built into all PubNub SDKs. With AES, all messages are encrypted & decrypted at the end-points so the data is not readable as it goes through PubNub. PubNub's AES/TLS solution is the most effective by both meeting HIPAA compliance requirements while providing use of the history
API, as needed.
For more information, check Retrieving messages and storage options