Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, customer support, or social interactions in SaaS products. Built on Ably's core service, it abstracts complex details to enable efficient chat architectures.
Everything you need to get started with Ably:
- Getting started with Ably Chat using Swift.
- Ably Chat SDK and usage docs in Swift.
- Learn about Ably Chat.
- API documentation.
- Chat Example App.
- Play with the livestream chat demo.
Ably aims to support a wide range of platforms. If you experience any compatibility issues, open an issue in the repository or contact Ably support.
This SDK supports the following platforms:
| Platform | Support |
|---|---|
| iOS | >= 14.0 |
| macOS | >= 11.0 |
| tvOS | >= 14.0 |
Note
Xcode 26.0 or later is required.
The SDK is distributed as a Swift Package and can be installed using Xcode or by adding it as a dependency in your package's Package.swift.
To install the ably-chat-swift package in your Xcode Project:
- Open your Xcode project and navigate to File → Add Package Dependencies...
- Paste
https://github.com/ably/ably-chat-swiftin the search box - Select the version you want to use
- Select the Ably Chat SDK for your target
To install the ably-chat-swift package in another Swift Package, add the following to your Package.swift:
.package(url: "https://github.com/ably/ably-chat-swift", from: "1.2.0"),The following code connects to Ably's chat service, subscribes to a chat room, and sends a message to that room:
import Ably
import AblyChat
// Initialize Ably Realtime client
let realtimeOptions = ARTClientOptions()
realtimeOptions.key = "<your-ably-api-key>"
realtimeOptions.clientId = "your-client-id"
let realtime = ARTRealtime(options: realtimeOptions)
// Create a chat client
let chatClient = ChatClient(realtime: realtime, clientOptions: ChatClientOptions())
// Get a chat room
let room = try await chatClient.rooms.get(named: "my-room", options: RoomOptions())
// Monitor room status
room.onStatusChange { statusChange in
switch statusChange.current {
case .attached:
print("Room is attached")
case .detached:
print("Room is detached")
case .failed(let error):
print("Room failed: \(error)")
default:
print("Room status: \(statusChange.current)")
}
}
// Attach to the room
try await room.attach()
// Subscribe to messages
let subscription = room.messages.subscribe { event in
print("Received message: \(event.message.text)")
}
// Send a message
try await room.messages.send(withParams: SendMessageParams(text: "Hello, World!"))The CHANGELOG.md contains details of the latest releases for this SDK. You can also view all Ably releases on changelog.ably.com.
Read the CONTRIBUTING.md guidelines to contribute to Ably or share feedback or request a new feature.
For help or technical support, visit Ably's support page. You can also view the community reported Github issues or raise one yourself.
