Skip to content

Commit 3f6fd2b

Browse files
authored
feat: Add support for ping stream. (#235)
BEGIN_COMMIT_OVERRIDE feat: Add support for ping stream. fix: Expose polling configuration type. END_COMMIT_OVERRIDE The primary purpose of this PR is to add ping stream support to allow the flutter client SDK to work with relay proxy in streaming mode. In order to add this functionality a bit of re-factoring has occurred. The core logic for doing a poll is now encapsulated into a "requestor". This ensures that the process used for making a poll in request to a "ping" event is using the same logic as a polling request. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds SSE ping support that triggers a flags poll, extracting shared polling logic into a new Requestor and updating data sources and tests accordingly. > > - **Data sources**: > - **Streaming** (`streaming_data_source.dart`): handle `ping` events; on ping, use `Requestor` to fetch all flags and emit `DataEvent`/`StatusEvent`; supports GET/REPORT; minor logging; exposes `httpClientFactory` for ping requests. > - **Polling** (`polling_data_source.dart`): refactor to use `Requestor` for requests; compute method from `useReport`; fix poll reschedule delay calculation; expose `httpClientFactory`. > - **New**: `requestor.dart` encapsulates polling request logic (URL building, headers/body, ETag handling, environment ID extraction, error mapping) and returns `DataSourceEvent?`. > - **Client wiring**: > - `ld_common_client.dart`: build a single `PollingDataSourceConfig` and pass it to `StreamingDataSource` for ping-driven polls. > - **Tests**: > - Update polling tests to new factory param; verify REPORT headers/body and URLs; confirm interval behavior and env ID extraction. > - Add streaming ping tests: triggers poll on ping, handles 200/304/error/network cases, and verifies GET vs REPORT. > - **Misc**: > - `.gitignore`: ignore `**/devtools_options.yaml`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d7e211b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 1e8c463 commit 3f6fd2b

File tree

9 files changed

+559
-217
lines changed

9 files changed

+559
-217
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ pubspec_overrides.yaml
3838
**/coverage/
3939
**/.flutter-plugins-dependencies
4040
**/.flutter-plugins
41+
**/devtools_options.yaml

0 commit comments

Comments
 (0)