Status Events for Unity SDK

Subscription loop

These status events apply to the subscription loop introduced in version 7.2.0 and enabled by default in version 8.0.0.

The PubNub Unity SDK provides status events to notify you about the state of the SDK through the PNStatusCategory enum and PNException types.


StatusDescription
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.
PNNetworkIssuesCategory
A subscribe event experienced connection issues when running.
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

StatusDescriptionDeprecated in versionRemoved in version
PNReconnectedCategory
SDK was able to reconnect to PubNub.
8.2.0
Not removed
PNAcknowledgmentCategory
Used for API operation success reporting. Now handled with operation-specific success callbacks.
8.2.0
Not removed
PNTimeoutCategory
Used when an API operation didn't receive a response from the server in time. Now represented by specific exceptions.
8.2.0
Not removed
PNRequestMessageCountExceededCategory
Received more messages than specified threshold. No direct equivalent; use operation-specific callbacks.
8.2.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.
8.2.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:

StatusDescription
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.
PNUnexpectedDisconnectCategory
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.
PNMalformedFilterExpressionCategory
Subscription request cannot be processed as the passed filter expression is malformed and cannot be evaluated.
PNUnknownCategory
The captured error is a minor client-side error or an unknown type at the time of SDK development.

Error events

The Unity 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
None
No error occurred.
NameResolutionFailure
DNS resolution failed. Please check network connectivity.
PublishOperationTimeout
A publish operation timed out.
ReceiveFailure
Failed to receive data from the server.
ConnectFailure
Failed to connect to the server. Please verify network reachability.
WebRequestCanceled
Request was cancelled before completion.
NoInternet
No internet connection detected.
UnsubscribedAfterMaxRetries
Unsubscribed after maximum retry attempts were exhausted.
MessageTooLarge
Message exceeded size limits.
Error CodeDescription
InvalidKey
The key provided is invalid.
InvalidSubscribeKey
The subscribe key is invalid or missing.
NoUuidSpecified
No UUID was specified.

Resource errors

Error CodeDescription
InvalidChannel
A required channel parameter is invalid or missing.
NotSubscribed
Operation attempted on a channel to which you're not subscribed.
DuplicateChannel
Attempted to subscribe to a channel you're already subscribed to.
EmptyGroupSubscription
Cannot subscribe to an empty channel group.
InvalidTimestamp
The timestamp provided is invalid.
Last updated on