---
source_url: https://www.pubnub.com/docs/sdks/swift/status-events
title: Status Events for Swift SDK
updated_at: 2026-06-04T11:13:10.973Z
sdk_name: PubNub Swift SDK
sdk_version: 10.1.6
---

> 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


# Status Events for Swift SDK

PubNub Swift SDK, use the latest version: 10.1.6

Install:

```bash
Add PubNub via Swift Package Manager or CocoaPods@10.1.6
```

The PubNub Swift Software Development Kit (SDK) reports status events that describe connection state and error conditions. This page explains each status and when it appears.

:::warning Subscribe loop
These status events apply to the latest subscription loop architecture introduced in version 6.3.0 and enabled by default in version 7.0.0
:::

The PubNub Swift SDK provides status events to notify you about the state of the SDK through the `ConnectionStatus` enum and `PubNubError` types.

## Subscription-related statuses

The `ConnectionStatus` enum defines the following values:

| Status | Description | Added in version |
| --- | --- | --- |
| `connected` | The connection has been established and is ready to receive real-time updates. | 3.0.0 |
| `disconnected` | The connection has been intentionally terminated. | 3.0.0 Enhanced with `PubNubError` parameter in 7.0.0 |
| `disconnectedUnexpectedly(PubNubError)` | The connection was unexpectedly lost, with [details about the error](#error-events). | 3.0.0 Enhanced with the `PubNubError` parameter in 7.0.0 |
| `connectionError(PubNubError)` | Failed to establish the initial connection, with [details about the error](#error-events). | 6.3.0 |
| `subscriptionChanged(channels: [String], groups: [String])` | The mix of subscribed channels and channel groups has changed. | 8.0.0 |

:::tip SDK connection lifecycle
Processes such as connecting and reconnecting are managed internally without emitting statuses. For more general information on statuses and reconnection policies, refer to [SDK Connection Lifecycle](https://www.pubnub.com/docs/general/setup/connection-management#sdk-connection-lifecycle).
:::

### Previous statuses

| Status | Description | Deprecated in version | Removed in version |
| --- | --- | --- | --- |
| `connecting` | The connection was in the process of connecting. | 6.3.0 | 8.0.0 |
| `reconnecting` | The connection was dropped and was in the process of reconnecting. For more information on reconnection, refer to [Configuration](https://www.pubnub.com/docs/sdks/swift/api-reference/configuration#automatic-retry). | 6.3.0 | 8.0.0 |

The `ConnectionStatus` enum also provides these properties to verify connection details:

| Property | Description |
| --- | --- |
| `isActive` | Indicates if the connection is currently active. |
| `isConnected` | Indicates if the connection is currently connected. |

## Error events

The Swift SDK uses `PubNubError` to provide detailed error information. Most error objects returned from the SDK can be cast to `PubNubError` using `error.pubNubError`.

:::tip Error handling
Each error category provides specific information about what went wrong, helping you implement appropriate error handling in your application.
:::

### Connection and network errors

| Error | Description |
| --- | --- |
| `timedOut` | An asynchronous operation timed out. |
| `nameResolutionFailure` | The host name for a URL couldn't be resolved. |
| `invalidURL` | A malformed/unsupported URL prevented a URL request from being initiated. |
| `connectionFailure` | A network resource was requested, but an internet connection hasn't been established. |
| `connectionOverDataFailure` | The request couldn't be completed due to issues with the cellular network. |
| `connectionLost` | A client or server connection was severed in the middle of a request. |
| `secureConnectionFailure` | An attempt to establish a secure connection failed. |
| `certificateTrustFailure` | There was an issue with the secure server certificate. |

### Authentication and authorization errors

| Error | Description |
| --- | --- |
| `unauthorized` | Access denied due to insufficient authentication/authorization. |
| `forbidden` | Authorization key is missing or doesn't have required permissions. |
| `invalidSubscribeKey` | The PubNub subscribe key used for the request is invalid. |
| `invalidPublishKey` | The PubNub publish key used for the request is invalid. |
| `missingPublishKey` | Required PubNub publish key is missing. |
| `missingSubscribeKey` | Required PubNub subscribe key is missing. |
| `missingPublishAndSubscribeKey` | Required publish and subscribe keys are both missing. |

### Request and response errors

| Error | Description |
| --- | --- |
| `invalidArguments` | At least one request parameter is invalid. |
| `invalidCharacter` | At least one invalid character in the request. |
| `requestContainedInvalidJSON` | The request contained a malformed JSON payload. |
| `malformedResponseBody` | Response is valid JSON but not formatted as expected. |
| `badServerResponse` | The URL Loading system received bad data from the server. |
| `responseDecodingFailure` | Client system couldn't parse network response. |
| `dataLengthExceedsMaximum` | The length of the resource data exceeds the maximum allowed. |
| `requestURITooLong` | URI of the request was too long to be processed. |
| `tooManyRequests` | You have exceeded the maximum number of requests per second allowed. |

### Service and feature errors

| Error | Description |
| --- | --- |
| `pushNotEnabled` | Mobile push notifications API requires the Mobile Push Notifications add-on. |
| `messageDeletionNotEnabled` | History delete API requires Message Persistence and Storage Delete add-ons. |
| `messageHistoryNotEnabled` | History API requires the Message Persistence add-on. |
| `multiplexingNotEnabled` | Multiplexing requires Stream Controller to be enabled. |
| `messageTooLong` | The message you attempted to publish was too large to transmit. |
| `messageCountExceededMaximum` | The number of messages returned exceeded the maximum allowed. |

### Other errors

| Error | Description |
| --- | --- |
| `unknown` | An unknown error has occurred. |
| `clientCancelled` | The request was cancelled by the application/user without error. |
| `sessionDeinitialized` | The Session was deinitialized while tasks were still executing. |
| `sessionInvalidated` | The Session's underlying URLSession was invalidated. |
| `longPollingRestart` | The long polling request needed to be cancelled to restart with new data. |