For AI agents: this page in Markdown: https://www.pubnub.com/docs/sdks/c-sharp/status-events.md. Documentation index: https://www.pubnub.com/llms-full.txt.

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.


StatusDescription
PNConnectedCategoryThe connection has been established and is ready to receive real-time updates.
PNDisconnectedCategoryThe connection has been intentionally terminated.
PNUnexpectedDisconnectCategoryThe connection was unexpectedly disconnected.
PNConnectionErrorCategoryFailed to establish the initial connection, with details about the error.
PNSubscriptionChangedCategoryThe 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​

StatusDescriptionDeprecated in versionRemoved in version
PNReconnectedCategorySDK was able to reconnect to PubNub. Now handled internally without a specific status. For more information on reconnection, refer to Configuration.6.20.0Not removed
PNAcknowledgmentCategoryAn 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.0Not removed
PNTimeoutCategoryUsed when an API operation didn't receive a response from the server in time. Now represented by specific exceptions.6.20.0Not removed
PNRequestMessageCountExceededCategoryReceived more messages than specified threshold. No direct equivalent; use operation-specific callbacks.6.20.0Not removed
PNNetworkIssuesCategoryIndicated network connectivity problems. Now represented as more specific status categories.6.20.0Not removed
PNMalformedResponseCategoryPubNub 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.0Not 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:

StatusDescription
PNAccessDeniedCategoryAuthorization failed, usually due to invalid keys or token.
PNCancelledCategoryThe operation was cancelled before completion.
PNDecryptionErrorCategoryMessage decryption failed, likely due to incorrect crypto key.
PNTLSConnectionFailedCategorySecure connection failed due to TLS/SSL issues.
PNTLSUntrustedCertificateCategoryTLS certificate validation failed.
PNBadRequestCategoryThe SDK is missing some required parameters, like message, channel, subscribe key, publish key.
PNNetworkIssuesCategoryThe 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.
PNTimeoutCategoryProcessing has failed because of request timeout.
PNNetworkIssuesCategoryThe 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.
PNUnknownCategoryThe captured error is a minor client-side error or an unknown type at the time of SDK development.
PNBadRequestCategoryThe SDK is missing some required parameters, like subscribe key or publish key.
PNTimeoutCategoryProcessing has failed because of request timeout.
PNReconnectedCategorySDK 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.

Common error types​

Error CodeDescription
NoneNo error occurred.
NameResolutionFailureDNS resolution failed. Please check network connectivity.
PublishOperationTimeoutA publish operation timed out.
ReceiveFailureFailed to receive data from the server.
ConnectFailureFailed to connect to the server. Please verify network reachability.
WebRequestCanceledRequest was cancelled before completion.
NoInternetNo internet connection detected.
UnsubscribedAfterMaxRetriesUnsubscribed after maximum retry attempts were exhausted.
MessageTooLargeMessage exceeded size limits.
Error CodeDescription
InvalidKeyThe key provided is invalid.
InvalidSubscribeKeyThe subscribe key is invalid or missing.
NoUuidSpecifiedNo UUID was specified.

Resource errors​

Error CodeDescription
InvalidChannelA required channel parameter is invalid or missing.
NotSubscribedOperation attempted on a channel to which you're not subscribed.
DuplicateChannelAttempted to subscribe to a channel you're already subscribed to.
EmptyGroupSubscriptionCannot subscribe to an empty channel group.
InvalidTimestampThe timestamp provided is invalid.

Was this page useful?

Last updated on