From 7798dbbe8079d27b6883ea6fc0730c82f59dc8f9 Mon Sep 17 00:00:00 2001 From: Brazol Date: Wed, 31 Jul 2024 16:47:51 +0200 Subject: [PATCH 1/2] watch support for queryCalls method --- .../Flutter/03-core-concepts/06-querying-calls.mdx | 11 ++++++++++- .../lib/src/coordinator/coordinator_client.dart | 1 + .../open_api/coordinator_client_open_api.dart | 2 ++ .../coordinator/retry/coordinator_client_retry.dart | 2 ++ packages/stream_video/lib/src/stream_video.dart | 2 ++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx b/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx index 8d0393436..0ae2890da 100644 --- a/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx +++ b/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx @@ -74,4 +74,13 @@ final result = await video.queryCalls( ); ``` -The `queryCalls` function can take multiple sort parameters, which can be combined with filtering to give you powerful control over the data in your application. \ No newline at end of file +The `queryCalls` function can take multiple sort parameters, which can be combined with filtering to give you powerful control over the data in your application. + +### Watching calls +​ +If you specify `watch` parameter as `true`, the SDK will create a subscription to the call data on the server and you'll be able to receive updates in real-time. + +The server will send updates to the client when the call data changes (for example, members are updated, a call session has started, etc...). This is useful for showing a live preview of who is in the call or building a call dashboard. + +You can listen to the call events via `StreamVideo.instance.events` stream + diff --git a/packages/stream_video/lib/src/coordinator/coordinator_client.dart b/packages/stream_video/lib/src/coordinator/coordinator_client.dart index 5a33e7393..963039d2d 100644 --- a/packages/stream_video/lib/src/coordinator/coordinator_client.dart +++ b/packages/stream_video/lib/src/coordinator/coordinator_client.dart @@ -187,6 +187,7 @@ abstract class CoordinatorClient { String? prev, List sorts = const [], int? limit, + bool? watch, }); Future> blockUser({ diff --git a/packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart b/packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart index 003205932..e85f1e805 100644 --- a/packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart +++ b/packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart @@ -875,6 +875,7 @@ class CoordinatorClientOpenApi extends CoordinatorClient { String? prev, List sorts = const [], int? limit, + bool? watch, }) async { try { final connectionResult = await _waitUntilConnected(); @@ -889,6 +890,7 @@ class CoordinatorClientOpenApi extends CoordinatorClient { prev: prev, sort: sorts, limit: limit, + watch: watch, ), ); if (result == null) { diff --git a/packages/stream_video/lib/src/coordinator/retry/coordinator_client_retry.dart b/packages/stream_video/lib/src/coordinator/retry/coordinator_client_retry.dart index 985c90c0b..3d0fab631 100644 --- a/packages/stream_video/lib/src/coordinator/retry/coordinator_client_retry.dart +++ b/packages/stream_video/lib/src/coordinator/retry/coordinator_client_retry.dart @@ -334,6 +334,7 @@ class CoordinatorClientRetry extends CoordinatorClient { String? prev, List sorts = const [], int? limit, + bool? watch, }) { return _retryManager.execute( () => _delegate.queryCalls( @@ -342,6 +343,7 @@ class CoordinatorClientRetry extends CoordinatorClient { prev: prev, sorts: sorts, limit: limit, + watch: watch, ), (error, nextAttemptDelay) async { _logRetry('queryCalls', error, nextAttemptDelay); diff --git a/packages/stream_video/lib/src/stream_video.dart b/packages/stream_video/lib/src/stream_video.dart index bbafcc655..5b52eecfa 100644 --- a/packages/stream_video/lib/src/stream_video.dart +++ b/packages/stream_video/lib/src/stream_video.dart @@ -527,6 +527,7 @@ class StreamVideo extends Disposable { String? prev, int? limit, List? sorts, + bool? watch, }) { return _client.queryCalls( filterConditions: filterConditions, @@ -534,6 +535,7 @@ class StreamVideo extends Disposable { limit: limit, prev: prev, sorts: sorts ?? [], + watch: watch, ); } From 9a936dc23087da18814d185e830a538ef0b80e0b Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Thu, 1 Aug 2024 12:02:10 +0200 Subject: [PATCH 2/2] Update docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx --- docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx b/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx index 0ae2890da..8362e03f8 100644 --- a/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx +++ b/docusaurus/docs/Flutter/03-core-concepts/06-querying-calls.mdx @@ -82,5 +82,5 @@ If you specify `watch` parameter as `true`, the SDK will create a subscription t The server will send updates to the client when the call data changes (for example, members are updated, a call session has started, etc...). This is useful for showing a live preview of who is in the call or building a call dashboard. -You can listen to the call events via `StreamVideo.instance.events` stream +You can listen to call events via the `StreamVideo.instance.events` stream.