Repository navigation
The 2.0.0 release moves the Chat SDK onto version 2 of the Ably Pub/Sub SDK, which is now published as ably-pubsub-cocoa. ably-pubsub-cocoa 2 is a device-side SDK, so a chat client built on it tells Ably that it runs on an end user's device. On an account billed by monthly active users, that traffic counts toward the total, the connection must carry a clientId, and that clientId is subject to a concurrency limit.
A chat client is now created through the createChatClient(pubSubClient:clientOptions:) function, in the same way that a Pub/Sub client is created through PubSubDevice.createClient(options:). This matches the Chat SDKs for other platforms.
Below is an overview of the major changes in this release.
For the changes to the Pub/Sub SDK itself, please refer to the ably-pubsub-cocoa v2 migration guide.
Package and dependencies
- The SDK depends on
ably-pubsub-cocoa2.x, in place ofably-cocoa1.x. - Import
AblyPubSubDevice, which replacesAbly.
Creating clients
- Create a Pub/Sub client with
PubSubDevice.createClient(options:). TheARTRealtimeinitializer is no longer available. - Create a chat client with
createChatClient(pubSubClient:clientOptions:).ChatClient's public initializer is removed, andChatClientOptionsis unchanged.
Chat client API
ChatClient.realtimeis renamed topubSubClient, and its type isPubSubClientin place ofARTRealtime.- On
ChatClientProtocol, therealtimeproperty is renamed topubSubClient, and theRealtimeassociated type is renamed toPubSubClient. ChatClient.roomsissome Rooms<RealtimeChannel>, in place ofsome Rooms<ARTRealtimeChannel>.
Swift API
- Swift sees the Pub/Sub SDK's types without the
ARTprefix:ARTClientOptionsisClientOptions,ARTRealtimeChannelisRealtimeChannel, and so on. - Some of these names are also used by the Chat SDK, such as
Message,ErrorInfoandPresence. In a file that imports bothAblyChatandAblyPubSubDevice, qualify the type with its module name, for exampleAblyChat.Message.
Migration example
// Before
import Ably
import AblyChat
let realtimeOptions = ARTClientOptions()
realtimeOptions.key = "<your-ably-api-key>"
realtimeOptions.clientId = "your-client-id"
let realtime = ARTRealtime(options: realtimeOptions)
let chatClient = ChatClient(realtime: realtime, clientOptions: ChatClientOptions())
// After
import AblyChat
import AblyPubSubDevice
let clientOptions = ClientOptions()
clientOptions.key = "<your-ably-api-key>"
clientOptions.clientId = "your-client-id"
let pubSubClient = PubSubDevice.createClient(options: clientOptions)
let chatClient = createChatClient(pubSubClient: pubSubClient, clientOptions: ChatClientOptions())Supported platforms changes
- Support for macOS earlier than 12, iOS earlier than 15 and tvOS earlier than 15 has been dropped.
Full Changelog: 1.2.1...2.0.0