diff --git a/Sources/AblyChat/ChatClient.swift b/Sources/AblyChat/ChatClient.swift index 3827deb6..5a5fb0f0 100644 --- a/Sources/AblyChat/ChatClient.swift +++ b/Sources/AblyChat/ChatClient.swift @@ -29,7 +29,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 23074557..f53958a2 100644 --- a/Sources/AblyChat/DefaultMessages.swift +++ b/Sources/AblyChat/DefaultMessages.swift @@ -188,6 +188,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