|
2 | 2 |
|
3 | 3 | This guide provides detailed instructions on how to upgrade between versions of the Chat SDK. |
4 | 4 |
|
| 5 | +## 0.7.x to 0.8.x |
| 6 | + |
| 7 | +### Protocol v4 changes |
| 8 | + |
| 9 | +**Expected Impact: Medium** |
| 10 | + |
| 11 | +The Chat SDK now supports protocol v4, which introduces changes to message structure and handling. |
| 12 | + |
| 13 | +#### Message Structure Changes |
| 14 | + |
| 15 | +**Before** |
| 16 | + |
| 17 | +```kotlin |
| 18 | +val message: Message = getMessage() |
| 19 | +val versionSerial: String = message.serial |
| 20 | +val createdAt: Long = message.createdAt |
| 21 | +val updatedAt: Long = message.timestamp |
| 22 | +``` |
| 23 | + |
| 24 | +**After** |
| 25 | + |
| 26 | +```kotlin |
| 27 | +val message: Message = getMessage() |
| 28 | +val versionSerial: String = message.version.serial |
| 29 | +val createdAt: Long = message.timestamp |
| 30 | +val updatedAt: Long = message.version.timestamp |
| 31 | +``` |
| 32 | + |
| 33 | +### Custom JSON Implementation |
| 34 | + |
| 35 | +**Expected Impact: Low** |
| 36 | + |
| 37 | +The SDK has replaced Gson with a custom JSON interface to reduce external dependencies. |
| 38 | + |
| 39 | +Affected fields: `Message.metadata`, `RoomReaction.metadata`, `Presence.data` |
| 40 | + |
| 41 | +To build a JSON object to send, use the `jsonObject` builder from `com.ably.chat.json`: |
| 42 | + |
| 43 | +```kotlin |
| 44 | +presence.enter(jsonObject { |
| 45 | + put("status", "active") |
| 46 | + putObject("profile") { |
| 47 | + put("username", "John Doe") |
| 48 | + put("img", "https://example.com/img") |
| 49 | + } |
| 50 | +}) |
| 51 | +``` |
| 52 | + |
| 53 | +### Presence Data JsonObject |
| 54 | + |
| 55 | +**Expected Impact: Low** |
| 56 | + |
| 57 | +Presence data must be a `JsonObject` rather than an arbitrary JSON value. |
| 58 | +The `enter()`, `leave()`, and `update()` methods now accept only a `JsonObject`. |
| 59 | + |
5 | 60 | ## 0.4.x to 0.5.x |
6 | 61 |
|
7 | 62 | ### Room Reaction Wire Protocol |
|
0 commit comments