@@ -6,6 +6,8 @@ import com.google.gson.JsonElement
6
6
import com.google.gson.JsonObject
7
7
import io.ably.lib.realtime.Channel
8
8
import io.ably.lib.realtime.Presence.GET_CLIENTID
9
+ import io.ably.lib.realtime.Presence.GET_CONNECTIONID
10
+ import io.ably.lib.realtime.Presence.GET_WAITFORSYNC
9
11
import io.ably.lib.types.Param
10
12
import io.ably.lib.types.PresenceMessage
11
13
import io.ably.lib.realtime.Presence as PubSubPresence
@@ -33,6 +35,11 @@ interface Presence : EmitsDiscontinuities {
33
35
*/
34
36
suspend fun get (params : List <Param > = listOf()): List <PresenceMember >
35
37
38
+ /* *
39
+ * @see #get(params)
40
+ */
41
+ suspend fun get (waitForSync : Boolean = false, clientId : String? = null, connectionId : String? = null): List <PresenceMember >
42
+
36
43
/* *
37
44
* Method to check if user with supplied clientId is online
38
45
* @param {string} clientId - The client ID to check if it is present in the room.
@@ -152,6 +159,15 @@ internal class DefaultPresence(
152
159
}
153
160
}
154
161
162
+ override suspend fun get (waitForSync : Boolean , clientId : String? , connectionId : String? ): List <PresenceMember > {
163
+ val params = buildList {
164
+ if (waitForSync) add(Param (GET_WAITFORSYNC , true ))
165
+ clientId?.let { add(Param (GET_CLIENTID , it)) }
166
+ connectionId?.let { add(Param (GET_CONNECTIONID , it)) }
167
+ }
168
+ return get(params)
169
+ }
170
+
155
171
override suspend fun isUserPresent (clientId : String ): Boolean = presence.getCoroutine(Param (GET_CLIENTID , clientId)).isNotEmpty()
156
172
157
173
override suspend fun enter (data : PresenceData ? ) {
0 commit comments