Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview][Integration] Room lifecycle manager #61

Closed
wants to merge 145 commits into from
Closed
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
6d2d24c
Added checks for current room state before room ATTACH operation
sacOO7 Oct 3, 2024
d018b0d
Implemented RoomStatus interface, added code to handle exceptions when
sacOO7 Oct 8, 2024
99c7363
Marked RoomOptions as optional as per spec
sacOO7 Oct 11, 2024
3067774
Added offAll method interface method to remove all listeners
sacOO7 Oct 11, 2024
8ffabb1
Refactored room interfaces, implemented DefaultRoomStatus class that
sacOO7 Oct 11, 2024
5b321c6
Replaced ChatEventEmitter with RoomStatusEventEmitter, implemented mi…
sacOO7 Oct 14, 2024
7943aba
Added proper logging for DefaultRoom room attach operation failure
sacOO7 Oct 15, 2024
21ac68a
Added RoomLifecycleManager class, defined basic interfaces needed for
sacOO7 Oct 15, 2024
0d7f9a9
Updated coroutine core as a direct dependency to chat-android package
sacOO7 Oct 16, 2024
ba0f81e
Implemented missing interfaces as a part of RoomLifeCycleManager
sacOO7 Oct 16, 2024
5daeaf3
Merge branch 'main' into feature/room-ATTACH
sacOO7 Oct 18, 2024
899363b
Fixed linting issues recommended by detekt
sacOO7 Oct 18, 2024
102513c
Updated ably-java dependency to latest version
sacOO7 Oct 21, 2024
572fd8d
Updated ContributesToRoomLifecycle channel property to CompletableDef…
sacOO7 Oct 21, 2024
da00860
Upgraded kotlinx.coroutines dependency to latest version
sacOO7 Oct 21, 2024
be11428
Renamed DefaultRoomStatusStatus class to DefaultStatus, same as chat-js
sacOO7 Oct 21, 2024
a68a2a7
Implemented basic definition for RoomLifeCycleManager
sacOO7 Oct 21, 2024
a5e837c
Added interface impl. for ContributesToRoomLifecycle and ResolvedCont…
sacOO7 Oct 21, 2024
5dfb474
Fixed linting errors in local files
sacOO7 Oct 21, 2024
e0d5dab
Made AblyRealtimeChannel as a explicit type for all room feature chan…
sacOO7 Oct 22, 2024
0460c5c
Added TODOs before initializing RoomLifeCycleManager, refactored room
sacOO7 Oct 22, 2024
b5a5e54
Removed unused coroutinescope from the RoomLifeCycleManager, added mi…
sacOO7 Oct 22, 2024
164f500
Implemented AtomicCoroutineScope using priorityQueue, added documenta…
sacOO7 Oct 22, 2024
b1a68de
Implemented RoomLifeCycleManager attach operation using AtomicCorouti…
sacOO7 Oct 22, 2024
bf60d1c
Added separate interface for HandlesDiscontinuity
sacOO7 Oct 22, 2024
98f38c1
Added interface implementation for EmitsDiscontinuities, added partial
sacOO7 Oct 22, 2024
0013be5
Implemented DiscontinuityEmitter, extended across all contributors
sacOO7 Oct 22, 2024
2b62982
Implemented runDownChannelsOnFailedAttach, doChannelWindDown to detach
sacOO7 Oct 22, 2024
f091c71
Implemented doRetry mechanism when room attach fails, added comments …
sacOO7 Oct 23, 2024
1eded83
Refactored roomlifecyclemanager, fixed properties backed by fields
sacOO7 Oct 25, 2024
d990bd6
Added basic unit tests for room lifecyclemanager attach
sacOO7 Oct 25, 2024
6718da2
Updated AtomicCoroutineScope, made async method thread safe, added fe…
sacOO7 Oct 28, 2024
95a6a2c
Updated atomicCoroutineScope to run operations under supplied scope,
sacOO7 Oct 29, 2024
3fdfd39
Merge branch 'feature/room-lifecycle-using-atomic-coroutinescope' int…
sacOO7 Oct 29, 2024
d9094b5
Added private property roomScope to class DefaultRoom,
sacOO7 Oct 29, 2024
0a6a45e
Merge branch 'feature/roomlifecycle-attach-with-retry' into tests/roo…
sacOO7 Oct 29, 2024
983ec92
Fixed RoomLifecycleManagerTest, added sequentialRoomScope property to…
sacOO7 Oct 29, 2024
18cc65d
Marked atomicCoroutineScope as internal to access from tests, added e…
sacOO7 Nov 5, 2024
4fe42d6
Removed experimental annotation from finishedProcessing property on
sacOO7 Nov 5, 2024
30ad922
Refactored RoomLifecycleManagerTest, added more assertions for CHA-RL1d
sacOO7 Nov 5, 2024
0a9d391
Marked atomicCoroutineScope as private, accessed via reflection+exten…
sacOO7 Nov 5, 2024
52005c0
Bumped up io.mocck test dependency to latest version
sacOO7 Nov 6, 2024
b6f4dbd
Added channel attach room lifecycle spec CHA-RL1f, CHA-RL1g, updated
sacOO7 Nov 6, 2024
1d92116
Added mising unit test case blocks for channel attach
sacOO7 Nov 6, 2024
29a9782
Added test for spec CHA-RL1h1 channel attach, improved exception hand…
sacOO7 Nov 7, 2024
7405d9c
Added cancel method for AtomicCoroutineScope to cancel pending jobs
sacOO7 Nov 7, 2024
456224b
Merge branch 'feature/room-lifecycle-using-atomic-coroutinescope' int…
sacOO7 Nov 7, 2024
0f400b1
Merge branch 'feature/roomlifecycle-attach-with-retry' into tests/roo…
sacOO7 Nov 7, 2024
54a01c3
Refactored roomLifeCycle ATTACH tests with respective spec
sacOO7 Nov 7, 2024
2fee93d
Added channel attach retry test as per spec CHA-RL1h3
sacOO7 Nov 7, 2024
e6b46ff
Added channel attach unit test for contributor failure, get all remai…
sacOO7 Nov 7, 2024
f097e96
Added channel attach failure test, retry channel detach remaining cha…
sacOO7 Nov 7, 2024
e73b9ba
Annotated RoomLifeCycleManager code with right spec tags, refactored …
sacOO7 Nov 8, 2024
ce9c0ba
Fixed RoomStatusEventEmitter typo,
sacOO7 Nov 8, 2024
d689419
Merge branch 'main' into feature/room-ATTACH
sacOO7 Nov 8, 2024
62a5dae
Merge branch 'feature/room-ATTACH' into feature/room-lifecycle-using-…
sacOO7 Nov 8, 2024
7718ad2
Updated code as per detekt linter suggestions, disabled LabeledReturn…
sacOO7 Nov 8, 2024
23e39fa
Merge branch 'feature/room-lifecycle-using-atomic-coroutinescope' int…
sacOO7 Nov 8, 2024
c874b5b
Fixed linting issues suggested by detekt, updated detekt.yml accordingly
sacOO7 Nov 8, 2024
0aac6ed
Marked DiscontinuityEmitter class as final instead of open
sacOO7 Nov 8, 2024
fc3983c
Fixed flaky test for atomic coroutine scope
sacOO7 Nov 8, 2024
290fb84
Moved DiscontinuityEmitter impl. duplication from contributors to
sacOO7 Nov 8, 2024
a9fffc2
Merge branch 'feature/roomlifecycle-attach-with-retry' into tests/roo…
sacOO7 Nov 8, 2024
774cc3b
Fixed linting issues for roomlifecycle attach tests
sacOO7 Nov 8, 2024
2ffc93c
Added basic checks for roomlifecycle detach operation
sacOO7 Nov 8, 2024
d0d2c9c
Refactored AtomicCoroutineScope, updated priorityQueue to accept any …
sacOO7 Nov 8, 2024
9695fea
Added remaining implementation for room detach operation
sacOO7 Nov 8, 2024
9d6b1a9
Appending current coroutineContext to make sure running/pending jobs …
sacOO7 Nov 9, 2024
05f4397
Removed flaky assertion from concurrent atomic coroutinescope test
sacOO7 Nov 9, 2024
ad8c071
Updated Connection Interfaces in accordance with latest DR/spec changes
sacOO7 Nov 11, 2024
0fae205
Refactored RoomLifeCycle and RoomStatus interfaces according to the D…
sacOO7 Nov 11, 2024
e9f3335
Merge branch 'feature/room-lifecycle-using-atomic-coroutinescope' int…
sacOO7 Nov 11, 2024
6e3145f
Fixed flaky assertions inside AtomicCoroutineTest
sacOO7 Nov 11, 2024
4fc33c7
Merge branch 'feature/roomlifecycle-attach-with-retry' into tests/roo…
sacOO7 Nov 11, 2024
097e82c
Added detach delay to fix test flakiness for channel detach
sacOO7 Nov 11, 2024
3527b1c
Merge branch 'tests/roomlifecycle-attach' into rename/room_and_connec…
sacOO7 Nov 11, 2024
be0635c
Merge branch 'rename/room_and_connection_status' into feature/roomlif…
sacOO7 Nov 11, 2024
8a05c4f
Fixed compile errors caused by RoomStatus.kt refactoring
sacOO7 Nov 11, 2024
a0978f1
Refactored channel detach and setStatus method of DefaultRoomLifecycle
sacOO7 Nov 12, 2024
18aa038
Created separate test package for room related ops, renamed RoomLifeC…
sacOO7 Nov 12, 2024
01ee13a
Added basic tests for room detach using roomLifeCycleManager
sacOO7 Nov 12, 2024
5bbaf6c
Added roomLifecycleManager detach tests for CHA-RL2e, CHA-RL2f and CH…
sacOO7 Nov 12, 2024
f4883bc
Refactored room attach tests with proper naming convention,
sacOO7 Nov 12, 2024
47716e1
Added room detach test as per CHA-RL2i
sacOO7 Nov 12, 2024
57dafb2
Added room detach failure test as per CHA-RL2h1
sacOO7 Nov 12, 2024
297c301
Added room detach failure test as per spec CHA-RL2h2
sacOO7 Nov 12, 2024
df6ac5b
Added room detach failure test as per spec CHA-RL2h3
sacOO7 Nov 12, 2024
cc4b259
Refactored roomlifecycle detach, added missing spec comments
sacOO7 Nov 12, 2024
919cf7d
Added basic impl. for room release as a part of roomLifeCycleManager
sacOO7 Nov 12, 2024
143bea3
Added missing impl for releaseChannels and doRelease method as a part of
sacOO7 Nov 13, 2024
52ba521
Added basic tests for roomlifecycle release as per CHA-RL3a and CHA-RL3b
sacOO7 Nov 13, 2024
4cac4eb
Added missing spec impl. for CHA-RL3j as per spec
sacOO7 Nov 13, 2024
c671e5c
Merge branch 'feature/roomlifecycle-release-with-retry' into test/roo…
sacOO7 Nov 13, 2024
cb3b5e6
Added roomlifecycle released test for spec CHA-RL3j
sacOO7 Nov 13, 2024
3a8bfe1
Added roomlifecycle release test for spec CHA-RL3c
sacOO7 Nov 14, 2024
1abf9d7
Added roomlifecycle release test for spec CHA-RL3k, wait for existing op
sacOO7 Nov 14, 2024
ee43f08
Added roomlifecycle release test for spec CHA-RL3l and CHA-RL3d
sacOO7 Nov 14, 2024
aa1ce39
Added roomlifecycle release tests for spec CHA-RL3e, CHA-RL3f, fixed …
sacOO7 Nov 15, 2024
3e77030
Added roomlifecycle release tests for spec CHA-RL3g
sacOO7 Nov 15, 2024
ee8fc59
Updated interface ContributesToRoomLifecycle, added release() method
sacOO7 Nov 15, 2024
5162ed6
Merge branch 'feature/roomlifecycle-release-with-retry' into test/roo…
sacOO7 Nov 15, 2024
bcbe5f7
Added room release test for spec CHA-RL3h
sacOO7 Nov 15, 2024
2e39a61
Annotated RoomLifeCycleManager release with related spec ids
sacOO7 Nov 15, 2024
c0df2b8
Refactored impl. room-lifecycle-retry,
sacOO7 Nov 15, 2024
74751d0
Added test helper for invoking private suspend methods.
sacOO7 Nov 16, 2024
f2186aa
Added room lifecycle retry test as per spec CHA-RL5c and CHA-RL5d
sacOO7 Nov 16, 2024
1988e98
Added room lifecycle retry test as per spec CHA-RL5e and CHA-RL5f
sacOO7 Nov 16, 2024
0496912
Updated room lifecycle manager with missing spec annoations for chann…
sacOO7 Nov 17, 2024
6068b4e
Added separate PrecedenceTest to execute operations as per lifecycle
sacOO7 Nov 17, 2024
c6b2589
Removed initializing status from RoomStatus as per CHA-RS1j.
sacOO7 Nov 18, 2024
13ce9e4
Removed ResolvedContributor interface, since it's no longer needed
sacOO7 Nov 18, 2024
b1c09b1
Merge branch 'main' into feature/rooms-async-get
sacOO7 Nov 18, 2024
8c5e02b
Updated Room implementation to initialize features based on provided …
sacOO7 Nov 18, 2024
a3d7bb4
Ignored flaky sandbox tests
sacOO7 Nov 18, 2024
bdccd57
Updated RoomOptions validity check and access with proper error codes
sacOO7 Nov 18, 2024
dcc9538
Added companion default for RoomOptions, added tests for the same
sacOO7 Nov 18, 2024
a183715
Removed release as a part of Room interface, it's an internal method and
sacOO7 Nov 19, 2024
f9586d0
Updated impl. for async rooms get and rooms release
sacOO7 Nov 19, 2024
e0d3621
Added unit tests for Rooms.get suspended method, moved RoomHelper under
sacOO7 Nov 19, 2024
d8f60f8
Added tests for Rooms release operation as per spec
sacOO7 Nov 19, 2024
f3ef0f8
Added test for room release cancelling room Get as per CHA-RC1g4, CHA…
sacOO7 Nov 21, 2024
eaba999
Added spec annotations as per CHA-RC2a
sacOO7 Nov 21, 2024
ef38602
Annotated Rooms.get and Rooms.release methods with related spec ids
sacOO7 Nov 21, 2024
76e0b01
tidy up room lifecycle manager
sacOO7 Nov 21, 2024
40d092c
Bumped up ably-java dependency to latest version 1.2.45
sacOO7 Nov 22, 2024
d5bc58a
Added integration test for Room, having integration with RoomLifecycl…
sacOO7 Nov 22, 2024
ae31f2b
Removed CHA-RL3c related impl. as per latest spec change
sacOO7 Nov 22, 2024
aeb2ba3
Merge branch 'tests/roomlifecycle-attach' into rename/room_and_connec…
sacOO7 Nov 22, 2024
ed090c6
Merge branch 'rename/room_and_connection_status' into feature/roomlif…
sacOO7 Nov 22, 2024
9b931a4
Merge branch 'feature/roomlifecycle-detach-with-retry' into tests/roo…
sacOO7 Nov 22, 2024
eee26c2
Merge branch 'tests/roomlifecycle-detach' into feature/roomlifecycle-…
sacOO7 Nov 22, 2024
b918f09
Merge branch 'feature/roomlifecycle-release-with-retry' into test/roo…
sacOO7 Nov 22, 2024
14d8090
Merge branch 'test/roomlifecycle-release' into tests/room-lifecycle-m…
sacOO7 Nov 22, 2024
c1a4504
Merge branch 'tests/room-lifecycle-manager-retry' into feature/rooms-…
sacOO7 Nov 22, 2024
64cb73e
Merge branch 'feature/roomlifecycle-detach-with-retry' into tests/roo…
sacOO7 Nov 22, 2024
69724c9
Merge branch 'tests/roomlifecycle-detach' into feature/roomlifecycle-…
sacOO7 Nov 22, 2024
87d9391
Merge branch 'feature/roomlifecycle-release-with-retry' into test/roo…
sacOO7 Nov 22, 2024
730aeae
Merge branch 'test/roomlifecycle-release' into tests/room-lifecycle-m…
sacOO7 Nov 22, 2024
9313999
Merge branch 'tests/room-lifecycle-manager-retry' into feature/rooms-…
sacOO7 Nov 22, 2024
94e7751
Merge branch 'main' into feature/rooms-async-get
sacOO7 Nov 22, 2024
e710788
Renamed ErrorCodes class to ErrorCode, HttpStatusCodes to HttpStatusCode
sacOO7 Nov 22, 2024
40c0981
Merge branch 'main' into feature/draft-room-lifecycle-manager
sacOO7 Nov 25, 2024
7f6d306
Fixed linting issues as per coderabbitai suggestions
sacOO7 Nov 25, 2024
5cd21cf
Refactored tests and related helpers as per review suggestions
sacOO7 Nov 25, 2024
f08e8c3
Added roomLogger to DefaultRoom, initialized features accordingly
sacOO7 Nov 25, 2024
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
93 changes: 93 additions & 0 deletions chat-android/src/main/java/com/ably/chat/AtomicCoroutineScope.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.ably.chat

import java.util.concurrent.PriorityBlockingQueue
import kotlin.coroutines.cancellation.CancellationException
import kotlin.coroutines.coroutineContext
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.launch

/**
* AtomicCoroutineScope is a thread safe wrapper to run multiple operations mutually exclusive.
* All operations are atomic and run with given priority.
* Accepts scope as a constructor parameter to run operations under the given scope.
* See [Kotlin Dispatchers](https://kt.academy/article/cc-dispatchers) for more information.
*/
class AtomicCoroutineScope(private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default)) {

private val sequentialScope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1))
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved

private class Job<T : Any>(
private val priority: Int,
val coroutineBlock: suspend CoroutineScope.() -> T,
val deferredResult: CompletableDeferred<T>,
val queuedPriority: Int,
) : Comparable<Job<*>> {
override fun compareTo(other: Job<*>) = when {
this.priority == other.priority -> this.queuedPriority.compareTo(other.queuedPriority)
else -> this.priority.compareTo(other.priority)
}
}

// Handles jobs of any type
private val jobs: PriorityBlockingQueue<Job<*>> = PriorityBlockingQueue() // Accessed from both sequentialScope and async method
private var isRunning = false // Only accessed from sequentialScope
private var queueCounter = 0 // Only accessed from synchronized method

val finishedProcessing: Boolean
get() = jobs.isEmpty() && !isRunning

val pendingJobCount: Int
get() = jobs.size

/**
* Defines priority for the operation execution and
* executes given coroutineBlock mutually exclusive under given scope.
*/
@Synchronized
fun <T : Any> async(priority: Int = 0, coroutineBlock: suspend CoroutineScope.() -> T): CompletableDeferred<T> {
val deferredResult = CompletableDeferred<T>()
jobs.add(Job(priority, coroutineBlock, deferredResult, queueCounter++))
sequentialScope.launch {
if (!isRunning) {
isRunning = true
while (jobs.isNotEmpty()) {
val job = jobs.poll()
job?.let {
safeExecute(it)
}
}
isRunning = false
}
}
return deferredResult
}
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved

private suspend fun <T : Any> safeExecute(job: Job<T>) {
try {
// Appends coroutineContext to cancel current/pending jobs when AtomicCoroutineScope is cancelled
scope.launch(coroutineContext) {
try {
val result = job.coroutineBlock(this)
job.deferredResult.complete(result)
} catch (t: Throwable) {
job.deferredResult.completeExceptionally(t)
}
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved
}.join()
} catch (t: Throwable) {
job.deferredResult.completeExceptionally(t)
}
}

/**
* Cancels ongoing and pending operations with given error.
* See [Coroutine cancellation](https://kt.academy/article/cc-cancellation#cancellation-in-a-coroutine-scope) for more information.
*/
@Synchronized
fun cancel(message: String?, cause: Throwable? = null) {
queueCounter = 0
sequentialScope.coroutineContext.cancelChildren(CancellationException(message, cause))
}
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved
}
12 changes: 6 additions & 6 deletions chat-android/src/main/java/com/ably/chat/ChatApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal class ChatApi(
metadata = params.metadata ?: mapOf(),
headers = params.headers ?: mapOf(),
)
} ?: throw AblyException.fromErrorInfo(ErrorInfo("Send message endpoint returned empty value", HttpStatusCodes.InternalServerError))
} ?: throw AblyException.fromErrorInfo(ErrorInfo("Send message endpoint returned empty value", HttpStatusCode.InternalServerError))
}

private fun validateSendMessageParams(params: SendMessageParams) {
Expand All @@ -90,8 +90,8 @@ internal class ChatApi(
throw AblyException.fromErrorInfo(
ErrorInfo(
"Metadata contains reserved 'ably-chat' key",
HttpStatusCodes.BadRequest,
ErrorCodes.InvalidRequestBody,
HttpStatusCode.BadRequest,
ErrorCode.InvalidRequestBody.code,
),
)
}
Expand All @@ -101,8 +101,8 @@ internal class ChatApi(
throw AblyException.fromErrorInfo(
ErrorInfo(
"Headers contains reserved key with reserved 'ably-chat' prefix",
HttpStatusCodes.BadRequest,
ErrorCodes.InvalidRequestBody,
HttpStatusCode.BadRequest,
ErrorCode.InvalidRequestBody.code,
),
)
}
Expand All @@ -117,7 +117,7 @@ internal class ChatApi(
connections = it.requireInt("connections"),
presenceMembers = it.requireInt("presenceMembers"),
)
} ?: throw AblyException.fromErrorInfo(ErrorInfo("Occupancy endpoint returned empty value", HttpStatusCodes.InternalServerError))
} ?: throw AblyException.fromErrorInfo(ErrorInfo("Occupancy endpoint returned empty value", HttpStatusCode.InternalServerError))
}

private suspend fun makeAuthorizedRequest(
Expand Down
96 changes: 96 additions & 0 deletions chat-android/src/main/java/com/ably/chat/Connection.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,73 @@
package com.ably.chat

import io.ably.lib.types.ErrorInfo

/**
* Default timeout for transient states before we attempt handle them as a state change.
*/
const val TRANSIENT_TIMEOUT = 5000

/**
* The different states that the connection can be in through its lifecycle.
*/
enum class ConnectionStatus(val stateName: String) {
/**
* A temporary state for when the library is first initialized.
*/
Initialized("initialized"),

/**
* The library is currently connecting to Ably.
*/
Connecting("connecting"),

/**
* The library is currently connected to Ably.
*/
Connected("connected"),

/**
* The library is currently disconnected from Ably, but will attempt to reconnect.
*/
Disconnected("disconnected"),

/**
* The library is in an extended state of disconnection, but will attempt to reconnect.
*/
Suspended("suspended"),

/**
* The library is currently disconnected from Ably and will not attempt to reconnect.
*/
Failed("failed"),
}

/**
* Represents a change in the status of the connection.
*/
data class ConnectionStatusChange(
/**
* The new status of the connection.
*/
val current: ConnectionStatus,

/**
* The previous status of the connection.
*/
val previous: ConnectionStatus,

/**
* An error that provides a reason why the connection has
* entered the new status, if applicable.
*/
val error: ErrorInfo?,

/**
* The time in milliseconds that the client will wait before attempting to reconnect.
*/
val retryIn: Long?,
)

/**
* Represents a connection to Ably.
*/
Expand All @@ -8,4 +76,32 @@ interface Connection {
* The current status of the connection.
*/
val status: ConnectionStatus

/**
* The current error, if any, that caused the connection to enter the current status.
*/
val error: ErrorInfo?

/**
* Registers a listener that will be called whenever the connection status changes.
* @param listener The function to call when the status changes.
* @returns An object that can be used to unregister the listener.
*/
fun onStatusChange(listener: Listener): Subscription

/**
* An interface for listening to changes for the connection status
*/
fun interface Listener {
/**
* A function that can be called when the connection status changes.
* @param change The change in status.
*/
fun connectionStatusChanged(change: ConnectionStatusChange)
}

/**
* Removes all listeners that were added by the `onStatusChange` method.
*/
fun offAllStatusChange()
}
101 changes: 0 additions & 101 deletions chat-android/src/main/java/com/ably/chat/ConnectionStatus.kt

This file was deleted.

Loading