For AI agents: this page in Markdown: https://www.pubnub.com/docs/sdks/javascript/faq.md. Documentation index: https://www.pubnub.com/llms-full.txt.

FAQ for JavaScript SDK

Why are there two subscribe methods?​

The JavaScript SDK supports a modern, SDK entity-based flow and retains a legacy subscribe() for backward compatibility.

Use the modern flow documented in Subscribe. It creates subscription or subscriptionSet objects, adds a single listener entry point, and can optionally resume from a timetoken using a cursor. The legacy builder pubnub.subscribe({ ... }) is documented in Subscribe (old) and remains for existing applications.

Why does encryption use AES-128 when cryptoModule is configured?​

If a call supplies a customCipherKey (for encrypt/decrypt) or a key (for encryptFile/decryptFile), that argument overrides the configured cryptoModule for that operation and uses legacy Advanced Encryption Standard (AES) with 128-bit keys. Remove those arguments to use the cryptoModule configuration (AES‑256‑CBC), or configure a separate cryptoModule instance for partial encryption scenarios.

For details, refer to CryptoModule configuration.

Was this page useful?

Last updated on