FAQ for C-Core SDK
Check out the frequently asked questions about the PubNub C-Core SDK.
Why is a user ID required?
The user ID uniquely identifies the client (end user, device, or server). Set and persist a stable value for the lifetime of the user or device; without it, the client cannot connect.
Can I publish and subscribe with a single context?
Yes, but not at the same time. To publish and subscribe concurrently, use separate contexts or a pool for publishing.
How do I choose static vs dynamic buffers?
Use static buffers when memory is tight and message sizes are predictable. Use dynamic buffers for large or variable replies. Review PUBNUB_DYNAMIC_REPLY_BUFFER
and PUBNUB_REPLY_MAXLEN
.
What happens if the transaction timer expires?
The SDK cancels the transaction locally and returns timeout
. Publishes that already reached the server are not rolled back.
Is the C-Core SDK thread safe?
Yes when compiled with thread-safety enabled, but you must still synchronize your own application data. Without thread safety, use one thread per context.
How do I reduce memory footprint?
Lower the number of contexts, use static buffers, disable proxy support and other unused modules, and enable PUBNUB_ONLY_PUBSUB
if you only need publish/subscribe.
Can I change the origin (DNS host) at runtime?
Yes if PUBNUB_ORIGIN_SETTABLE
is enabled. Passing NULL
resets the origin to the default.
What are the default retry settings for subscribe?
Exponential backoff with up to 6 retries, increasing delays from 2 to 150 seconds.
Why am I missing subscribe messages?
Static reply buffers may truncate large responses, and long gaps can advance the subscribe cursor. Increase PUBNUB_REPLY_MAXLEN
or review your subscribe loop configuration.
Which encryption should I use?
Prefer 256-bit AES-CBC. Legacy 128-bit encryption remains available for backward compatibility. See the Encryption docs.
How do I enable Transport Layer Security (TLS)?
Call the SSL configuration API with TLS enabled to secure all communications with PubNub.
Can I use the old subscribe functions with the event engine enabled?
No. When PUBNUB_USE_SUBSCRIBE_EVENT_ENGINE
is ON
, do not call pubnub_subscribe
or pubnub_subscribe_v2
.
How do I use a proxy?
Enable PUBNUB_PROXY_API
and configure host, port, and protocol using the proxy APIs.