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

FAQ for Python-Asyncio SDK

Check out the frequently asked questions about the PubNub Python-Asyncio SDK.

Can I use the synchronous Python client alongside Asyncio?​

Yes. Use the PubNub client for synchronous workflows and PubNubAsyncio for asynchronous workflows. Keep the clients initialized separately to avoid event loop conflicts.

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.

How do I enable Transport Layer Security?​

Set pnconfig.ssl = True during configuration. This enables Transport Layer Security (TLS) for all communications with PubNub.

How do I choose a custom HTTP request handler?​

Provide custom_request_handler when initializing PubNubAsyncio. If not specified, the SDK checks the PUBNUB_ASYNC_REQUEST_HANDLER environment variable and defaults to AsyncHttpxRequestHandler if unset or invalid.

Why am I not receiving messages after subscribing?​

Messages published before the subscribe() call are not delivered by default. Ensure your app subscribes before publishing, or use features like history to retrieve previous messages when applicable.

Can I subscribe to multiple channels at once?​

Yes. Use a SubscriptionSet to manage multiple Subscriptions together, or use wildcard subscriptions or channel groups where supported.

How do I filter messages server-side?​

Use pnconfig.filter_expression to set a filter expression. The Stream Controller add-on must be enabled for your keyset.

How do I grant access with Access Manager?​

Use the secret_key only on secure server-side platforms. The client signs Access Manager messages with the secret_key. Never expose this key in client-side code.

How do I troubleshoot connection issues?​

Check status events such as PNConnectionErrorCategory and PNUnexpectedDisconnectCategory. For details, refer to Status Events in the Asyncio documentation.

Was this page useful?

Last updated on