Commit 3f6fd2b
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
9 files changed
Lines changed: 559 additions & 217 deletions
File tree
- apps/flutter_client_contract_test_service
- packages/common_client
- lib
- src
- data_sources
- test/data_sources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
0 commit comments