Skip to content

Commit 0998dff

Browse files
authored
Merge pull request #466 from ably/connection-status-enums-missing-vals
connection: add missing closing/closed statuses
2 parents a4f5fa0 + 13c1127 commit 0998dff

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Sources/AblyChat/Connection.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@ public enum ConnectionStatus: Sendable {
108108
*/
109109
case failed
110110

111+
// (CHA-CS1g) The @CLOSING@ status is used when a user has called @close@ on the underlying Realtime client and it is attempting to close the connection with Ably. The library will not attempt to reconnect.
112+
113+
/**
114+
* An explicit request by the developer to close the connection has been sent to the Ably service.
115+
* If a reply is not received from Ably within a short period of time, the connection is forcibly
116+
* terminated and the connection status becomes Closed.
117+
*/
118+
case closing
119+
120+
// (CHA-CS1h) The @CLOSED@ status is used when the @close@ call on the underlying Realtime client has succeeded, either via mutual agreement with the server or forced after a time out. The library will not attempt to reconnect.
121+
122+
/**
123+
* The connection has been explicitly closed by the client.
124+
* In the closed state, no reconnection attempts are made automatically.
125+
* No connection state is preserved by the service or the library.
126+
*/
127+
case closed
128+
111129
internal static func fromRealtimeConnectionState(_ state: ARTRealtimeConnectionState) -> Self {
112130
switch state {
113131
case .initialized:
@@ -120,8 +138,12 @@ public enum ConnectionStatus: Sendable {
120138
.disconnected
121139
case .suspended:
122140
.suspended
123-
case .failed, .closing, .closed:
141+
case .failed:
124142
.failed
143+
case .closing:
144+
.closing
145+
case .closed:
146+
.closed
125147
@unknown default:
126148
.failed
127149
}

0 commit comments

Comments
 (0)