diff --git a/Sources/AblyChat/ChatClient.swift b/Sources/AblyChat/ChatClient.swift index 917a22f1..79b27d9c 100644 --- a/Sources/AblyChat/ChatClient.swift +++ b/Sources/AblyChat/ChatClient.swift @@ -28,7 +28,7 @@ public actor DefaultChatClient: ChatClient { } public nonisolated var clientID: String { - fatalError("Not yet implemented") + realtime.clientId ?? "" } } diff --git a/Sources/AblyChat/DefaultMessages.swift b/Sources/AblyChat/DefaultMessages.swift index d11b283d..784fa37b 100644 --- a/Sources/AblyChat/DefaultMessages.swift +++ b/Sources/AblyChat/DefaultMessages.swift @@ -184,6 +184,10 @@ internal final class DefaultMessages: Messages, EmitsDiscontinuities { } } + if channel.state == .initialized { + channel.attach() + } + // (CHA-M5b) If a subscription is added when the underlying realtime channel is in any other state, then its subscription point becomes the attachSerial at the the point of channel attachment. return try await timeserialOnChannelAttach() } diff --git a/Sources/AblyChat/Errors.swift b/Sources/AblyChat/Errors.swift index d4d153c8..d49b068d 100644 --- a/Sources/AblyChat/Errors.swift +++ b/Sources/AblyChat/Errors.swift @@ -14,7 +14,7 @@ public enum ErrorCode: Int { /// ``Rooms.get(roomID:options:)`` was called with a different set of room options than was used on a previous call. You must first release the existing room instance using ``Rooms.release(roomID:)``. /// /// TODO this code is a guess, revisit in https://github.com/ably-labs/ably-chat-swift/issues/32 - case inconsistentRoomOptions = 1 + case inconsistentRoomOptions = 40000 case messagesAttachmentFailed = 102_001 case presenceAttachmentFailed = 102_002