Status Events for C# SDK
The PubNub C# Software Development Kit (SDK) reports status events that describe connection state and error conditions. This page explains each status and when it appears.
Subscribe loop
These status events apply to the latest subscription loop architecture introduced in version 6.20.0 and enabled by default in version 7.0.0.
The PubNub C# SDK provides status events to notify you about the state of the SDK through the PNStatusCategory enum and PNException types.
Subscription-related statuses
| Status | Description |
|---|---|
PNConnectedCategory | The connection has been established and is ready to receive real-time updates. |
PNDisconnectedCategory | The connection has been intentionally terminated. |
PNUnexpectedDisconnectCategory | The connection was unexpectedly disconnected. |
PNConnectionErrorCategory | Failed to establish the initial connection, with details about the error. |
PNSubscriptionChangedCategory | The mix of subscribed channels and channel groups has changed. This event returns two lists: one with all subscribed channels and the second with all subscribed channel groups. |
Previous status categories
| Status | Description | Deprecated in version | Removed in version |
|---|---|---|---|
PNReconnectedCategory | SDK was able to reconnect to PubNub. Now handled internally without a specific status. For more information on reconnection, refer to Configuration. | 6.20.0 | Not removed |
PNAcknowledgmentCategory | An API call was successful. This status has additional details based on the type of the successful operation. Now handled with operation-specific success callbacks. | 6.20.0 | Not removed |
PNTimeoutCategory | Used when an API operation didn't receive a response from the server in time. Now represented by specific exceptions. | 6.20.0 | Not removed |
PNRequestMessageCountExceededCategory | Received more messages than specified threshold. No direct equivalent; use operation-specific callbacks. | 6.20.0 | Not removed |
PNNetworkIssuesCategory | Indicated network connectivity problems. Now represented as more specific status categories. | 6.20.0 | Not removed |
PNMalformedResponseCategory | PubNub sent a malformed response. This may happen when you connect to a public WiFi that requires you to log in via your web browser first, there is a proxy somewhere returning an HTML access denied error, or if there was an intermittent server issue. This status category is not actively emitted. Malformed responses now trigger a PNUnexpectedDisconnectCategory status with appropriate error details. | 6.20.0 | Not removed |
SDK connection lifecycle
Intermediate states like connecting and reconnecting are now handled internally without emitting specific statuses. For more general information on statuses and reconnection policies, refer to SDK Connection Lifecycle.
Other statuses
The SDK provides additional statuses for various operations:
| Status | Description |
|---|---|
PNAccessDeniedCategory | Authorization failed, usually due to invalid keys or token. |
PNCancelledCategory | The operation was cancelled before completion. |
PNDecryptionErrorCategory | Message decryption failed, likely due to incorrect crypto key. |
PNTLSConnectionFailedCategory | Secure connection failed due to TLS/SSL issues. |
PNTLSUntrustedCertificateCategory | TLS certificate validation failed. |
PNBadRequestCategory | The SDK is missing some required parameters, like message, channel, subscribe key, publish key. |
PNNetworkIssuesCategory | The SDK is not able to reach PubNub servers because the machine or device doesn't have Internet connection or the SDK is behind a proxy. |
PNTimeoutCategory | Processing has failed because of request timeout. |
PNNetworkIssuesCategory | The SDK is not able to reach PubNub servers because the machine or device doesn't have Internet connection or the SDK is behind a proxy. |
PNUnknownCategory | The captured error is a minor client-side error or an unknown type at the time of SDK development. |
PNBadRequestCategory | The SDK is missing some required parameters, like subscribe key or publish key. |
PNTimeoutCategory | Processing has failed because of request timeout. |
PNReconnectedCategory | SDK was able to reconnect to PubNub. |
Error events
The C# SDK uses PNException to provide detailed error information. Most errors are returned in the exception property of the PNStatus object.