Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions chat/api/android/chat.api
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public final class com/ably/chat/ConnectionKt {
}

public final class com/ably/chat/ConnectionStatus : java/lang/Enum {
public static final field Closed Lcom/ably/chat/ConnectionStatus;
public static final field Closing Lcom/ably/chat/ConnectionStatus;
public static final field Connected Lcom/ably/chat/ConnectionStatus;
public static final field Connecting Lcom/ably/chat/ConnectionStatus;
public static final field Disconnected Lcom/ably/chat/ConnectionStatus;
Expand Down
2 changes: 2 additions & 0 deletions chat/api/jvm/chat.api
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public final class com/ably/chat/ConnectionKt {
}

public final class com/ably/chat/ConnectionStatus : java/lang/Enum {
public static final field Closed Lcom/ably/chat/ConnectionStatus;
public static final field Closing Lcom/ably/chat/ConnectionStatus;
public static final field Connected Lcom/ably/chat/ConnectionStatus;
public static final field Connecting Lcom/ably/chat/ConnectionStatus;
public static final field Disconnected Lcom/ably/chat/ConnectionStatus;
Expand Down
18 changes: 16 additions & 2 deletions chat/src/commonMain/kotlin/com/ably/chat/Connection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ public enum class ConnectionStatus(public val stateName: String) {
* (CHA-CS1f) The library is currently disconnected from Ably and will not attempt to reconnect.
*/
Failed("failed"),

/**
* (CHA-CS1g) An explicit request by the developer to close the connection has been sent
* to the Ably service. If a reply is not received from Ably within a short period of
* time, the connection is forcibly terminated and the connection status becomes Closed.
*/
Closing("closing"),

/**
* (CHA-CS1h) The connection has been explicitly closed by the client. In the closed state,
* no reconnection attempts are made automatically. No connection state is preserved by
* the service or the library.
*/
Closed("closed"),
}

/**
Expand Down Expand Up @@ -187,7 +201,7 @@ private fun mapPubSubStatusToChat(status: ConnectionState): ConnectionStatus {
ConnectionState.disconnected -> ConnectionStatus.Disconnected
ConnectionState.suspended -> ConnectionStatus.Suspended
ConnectionState.failed -> ConnectionStatus.Failed
ConnectionState.closing -> ConnectionStatus.Failed
ConnectionState.closed -> ConnectionStatus.Failed
ConnectionState.closing -> ConnectionStatus.Closing
ConnectionState.closed -> ConnectionStatus.Closed
}
}
Loading