---
source_url: https://www.pubnub.com/docs/sdks/c-sharp/faq
title: FAQ for C# SDK
updated_at: 2026-05-29T11:10:16.652Z
sdk_name: PubNub C# SDK
sdk_version: 8.2.0
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# FAQ for C# SDK

PubNub C# SDK, use the latest version: 8.2.0

Install:

```bash
dotnet add package PubNub@8.2.0
```

Check out the frequently asked questions about the PubNub C# SDK.

## Why is a UserId required?

The `UserId` 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 one client?

Yes. The client supports concurrent operations when using the event engine. For explicit control, use separate subscriptions or distinct instances.

## How do I enable Transport Layer Security (TLS)?

Set `pnConfiguration.Secure = true` to enable TLS for all communications with PubNub.

## Why am I not receiving messages after subscribing?

Messages published before `Subscribe()` are not delivered by default. Subscribe first, then publish. Use history to fetch earlier messages when needed.

## How do I filter messages server-side?

Set `pnConfiguration.FilterExpression`. The Stream Controller add-on must be enabled for your keyset.

## Which encryption should I use?

Prefer `AesCbcCryptor(CipherKey)` for 256‑bit AES‑CBC. The legacy cryptor is available for backward compatibility.

## How do I configure reconnection behavior?

Use `ReconnectionPolicy` (NONE, LINEAR, EXPONENTIAL) and optionally set `ConnectionMaxRetries`. With the event engine, use `RetryConfiguration.Linear(...)` or `RetryConfiguration.Exponential(...)`.

## How do I reduce duplicate messages across regions?

Enable `DedupOnSubscribe` and tune `MaximumMessagesCacheSize`.

## How do I use a proxy?

Set a `Proxy` on `PNConfiguration` with the required host, port, and protocol.

## Why are there two subscribe() methods?

The C# SDK offers a modern, entity-based subscribe API and retains a legacy subscribe API for backward compatibility.

Use the modern entity-based approach documented in [Subscribe](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#subscribe), which creates `Subscription` or `SubscriptionSet` instances, relies on a listener model, and can optionally resume from a timetoken via `SubscriptionCursor`.

The legacy global builder `pubnub.Subscribe<string>()` is documented in [Subscribe (old)](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#subscribe-old) and remains for existing applications.

## Which subscribe() should I use?

For new development, use the modern [Subscribe](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#subscribe) with `Subscription`/`SubscriptionSet` and listeners. Configure presence delivery with [SubscriptionOptions](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#subscriptionoptions) and resume with `SubscriptionCursor` when needed.

For maintaining older apps, continue using [Subscribe (old)](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#subscribe-old) until you migrate. When migrating, create entities, add [event listeners](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/publish-and-subscribe#event-listeners), and optionally resume from a specific timetoken using `SubscriptionCursor`.

## Why does encryption use AES-128 when CryptoModule is configured?

If a call supplies a `cipherKey` argument (for example, in `Encrypt`, `EncryptFile`, `Decrypt`, or `DecryptFile`), that argument overrides the configured `CryptoModule` for that operation and uses legacy Advanced Encryption Standard (AES) with 128-bit keys. Remove the `cipherKey` argument to use the `CryptoModule` configuration (AES‑256‑CBC), or configure a separate `CryptoModule` instance for partial encryption scenarios.

For details, refer to [CryptoModule configuration](https://www.pubnub.com/docs/sdks/c-sharp/api-reference/configuration#cryptomodule).

## Terms in this document

* **Entity** - A subscribable object within a PubNub SDK that allows you to perform context-specific operations.
* **Listener** - A function or objectthat reacts to events or messages, like new chat messages or connection updates, letting your app respond in real-time.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
* **Timetoken** - A unique identifier for each message that represents the number of 100-nanosecond intervals since January 1, 1970, for example, 16200000000000000.