This guide provides detailed instructions on how to upgrade between versions of the Chat SDK.
Expected Impact: Low
The MessageOptions class has been renamed to MessagesOptions for consistency with other SDKs.
Before
val options: MessageOptions = room.options.messagesAfter
val options: MessagesOptions = room.options.messagesExpected Impact: Low
The MessagesReactions class has been renamed to MessageReactions for consistency with other SDKs.
Before
val reactions: MessagesReactions = room.messages.reactionsAfter
val reactions: MessageReactions = room.messages.reactionsExpected Impact: Low
The MessageAction enum no longer includes internal Meta and Summary values. These values were not part of the public API and should not have been used in application code. The enum now only contains the three public action types: MessageCreate, MessageUpdate, and MessageDelete.
No code changes are required unless you were incorrectly using these internal values.
Expected Impact: Low
Interface-based listeners have been replaced with Kotlin function types for a more idiomatic API. This affects binary-compatibility mostly for all subscription methods throughout the SDK.
This change applies to all subscription methods including:
Messages.subscribe()Presence.subscribe()RoomReactions.subscribe()Occupancy.subscribe()Typing.subscribe()Room.onStatusChange()Connection.onStatusChange()
Expected Impact: Medium
The Chat SDK now throws ChatException instead of AblyException. This provides better error handling specificity for chat-related operations.
Before
import io.ably.lib.types.AblyException
try {
room.attach()
} catch (e: AblyException) {
// Handle error
}After
import com.ably.chat.*
try {
room.attach()
} catch (e: ChatException) {
// Handle error
}Expected Impact: Medium
Status properties have been changed from current() function to current property for cleaner, more idiomatic Kotlin syntax.
Before
val occupancyData = occupancy.current()
val typingClients = typing.current()After
val occupancyData = occupancy.current
val typingClients = typing.currentThis change applies to:
Occupancy.currentTyping.current
Expected Impact: High
Several types now import from com.ably.chat instead of their previous locations. This ensures consistency and clarity about which types are part of the Chat SDK public API.
Before
import io.ably.lib.types.ErrorInfo
import io.ably.lib.types.MessageActionAfter
import com.ably.chat.*Expected Impact: Low
The chat-compose-extension module has been promoted from experimental to stable.
Made extensions return State<*> instead of plain objects to avoid unnecessary recompositions:
Before
val roomStatus = room.collectAsStatus()
val connectionStatus = connection.collectAsStatus()
val currentlyTyping = room.collectAsCurrentlyTyping()
val presentMembers = room.collectAsPresenceMembers()
val occupancy = room.collectAsOccupancy()After
val roomStatus by room.collectAsStatus()
val connectionStatus by connection.collectAsStatus()
val currentlyTyping by room.collectAsCurrentlyTyping()
val presentMembers by room.collectAsPresenceMembers()
val occupancy by room.collectAsOccupancy()Expected Impact: Medium
The Chat SDK now supports protocol v4, which introduces changes to message structure and handling.
Before
val message: Message = getMessage()
val versionSerial: String = message.serial
val createdAt: Long = message.createdAt
val updatedAt: Long = message.timestampAfter
val message: Message = getMessage()
val versionSerial: String = message.version.serial
val createdAt: Long = message.timestamp
val updatedAt: Long = message.version.timestampExpected Impact: Low
The SDK has replaced Gson with a custom JSON interface to reduce external dependencies.
Affected fields: Message.metadata, RoomReaction.metadata, Presence.data
To build a JSON object to send, use the jsonObject builder from com.ably.chat.json:
presence.enter(jsonObject {
put("status", "active")
putObject("profile") {
put("username", "John Doe")
put("img", "https://example.com/img")
}
})Expected Impact: Low
Presence data must be a JsonObject rather than an arbitrary JSON value.
The enter(), leave(), and update() methods now accept only a JsonObject.
Expected Impact: Medium
The room reactions wire protocol has been updated to reflect the change below. If you are using multiple SDKs (e.g. Mobile, Web), please ensure you update them at the same time to avoid compatibility issues.
Expected Impact: Medium
The Reaction interface and related types have been renamed to RoomReaction to disambiguate against message reactions. The property type has been renamed to name.
The following types have been renamed:
Reaction→RoomReaction
Before
room.reactions.send(type = "like")After
room.reactions.send(name = "like")Expected Impact: High
roomId has been renamed to name or roomName throughout the SDK.
This is to align terminology more closely with other Ably SDKs.
Expected Impact: Medium
In Occupancy, Room Reactions and Presence, the event received by the listeners you subscribe has changed to match the style used by messages and typing indicators. The main change is that the entity (e.g. presence member) is now nested in the event.
All of the data that you originally had accessible by the old event versions is still present, just in different places.
Before
room.presence.subscribe { event ->
// Log the presence member
println(event)
// Log the presence event type
println(event.action)
}After
room.presence.subscribe { event ->
// Log the presence member
println(event.member)
// Log the presence event type
println(event.type)
}Before
room.occupancy.subscribe { event ->
// Log the number of connections
println(event.connections)
}After
room.occupancy.subscribe { event ->
// Log the number of connections
println(event.occupancy.connections)
}Before
room.reactions.subscribe { event ->
// Log the reaction type
println(event.type)
}After
room.reactions.subscribe { event ->
// Log the reaction type
println(event.reaction.type)
}Expected Impact: Low
- Sending typing indicators now requires the connection status to be
Connected. - Sending room reactions now requires the connection status to be
Connected.
This is to avoid messages being queued, which is in contrast to their ephemeral instantaneous use-case.