Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 16 additions & 16 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies
run: dart pub get --no-example
- name: Analyze
run: dart analyze
- name: Run DDP protocol tests (no server required)
run: dart test test/ddp_mock_server_test.dart
- name: Run connection lifecycle tests (no server required)
run: dart test test/lifecycle_test.dart
- name: Prepare docker network
run: docker network create test_net
- name: Start MongoDB
run: docker run --rm --name mongodb --network test_net -d mongo
- run: docker ps
- run: sleep 5
- run: docker ps
- name: Start webapp
run: docker run --rm --name webapp --network test_net -p 3000:3000 -e "MONGO_URL=mongodb://mongodb:27017/meteor" -e "ROOT_URL=http://webapp" -d tanutapi/simple-meteor-chat:latest
run: docker run --rm --name webapp --network test_net -p 3000:3000 -e "MONGO_URL=mongodb://mongodb:27017/meteor" -e "ROOT_URL=http://webapp" -d tanutapi/simple-meteor-chat:latest
- run: sleep 30
- run: docker ps
- run: docker logs webapp
- run: sudo apt-get update
- run: sudo apt-get install apt-transport-https curl -y
- name: Check webapp
run: curl 127.0.0.1:3000
- run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
- run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- run: sudo apt-get update
- name: Install dart
run: sudo apt-get install dart -y
- run: export PATH="$PATH:/usr/lib/dart/bin"
- uses: actions/checkout@v1
- name: Install dependencies
run: rm -rf ./example && PATH="$PATH:/usr/lib/dart/bin" dart pub get
- name: Run tests
run: PATH="$PATH:/usr/lib/dart/bin" dart run test
- name: Run integration tests
run: dart test test/dart_meteor_test.dart
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
# 4.1.0

Connection lifecycle fixes. The theme is a device that goes to sleep: the
process is suspended, timers stop, and the server drops the session without the
socket ever reporting an error.

Fixed:
- A missed `pong` left the client permanently offline. The pong timeout called
`disconnect()`, which also disabled reconnection, so no retry was ever
scheduled — the exact path a device takes when it wakes with a stale socket.
- Reconnect backoff never engaged. `retryCount` was reset on every connection
attempt, so the computed interval was always 0s and `maxRetryCount` was never
reached, producing a tight reconnect loop. The counter is now reset only once
the server accepts the connection.
- Connecting to an unreachable server raised an **unhandled** exception that
could terminate the application, because `WebSocketChannel.connect` fails
asynchronously rather than throwing. The client now awaits `ready` and routes
the failure into its normal retry path.
- A method call that was in flight when the connection dropped never completed.
Pending calls are now completed with the new `MeteorConnectionError`.
- Subscriptions were re-sent before the login token was resumed, so
publications depending on `this.userId` re-ran unauthenticated after every
reconnect. Re-subscription now waits for the `onReconnect` callbacks.
- `disconnect()` did not cancel a pending reconnect timer, so an explicit
disconnect could be undone by a retry that was already scheduled.
- `status()` emitted the client's own mutable status object, so a fast
transition could be misread by subscribers. Each event is now a snapshot.

Added:
- `meteor.notifyAppPaused()` / `meteor.notifyAppResumed()` and
`meteor.checkLiveness()`. On resume the client compares the wall clock
against the last message received and replaces a stale connection
immediately, instead of waiting for a ping to time out. The package stays
pure Dart; the Flutter `WidgetsBindingObserver` glue is a few lines shown in
the README and in `example/`.
- Configurable `pingInterval`, `pongTimeout`, `maxRetryInterval` and
`stalenessThreshold` on `MeteorClient.connect` and `DdpClient`.
- `test/lifecycle_test.dart`, a server-free regression suite for the above; the
mock DDP server moved to `test/mock_ddp_server.dart` so both suites share it.

Behaviour changes to be aware of when upgrading:
- `await meteor.call(...)` can now throw `MeteorConnectionError` where it
previously hung forever. In-flight calls are **not** retried automatically,
since methods are not necessarily idempotent.
- Reconnect attempts are spaced out rather than immediate.
- `onReconnect` callbacks may now return a `Future`, which is awaited before
subscriptions are re-sent.

# 4.0.0
- Support for the latest Dart/Flutter releases (tested with Dart 3.13). The minimum SDK is now Dart 3.6.
- Verified compatibility with Meteor 3.x servers, including Meteor 3.5.1 (DDP protocol version 1, SHA-256 password login, EJSON `$date` handling).
- Web platform support from the 4.0.0 betas via `web_socket_channel` is included.
- Added a standalone DDP protocol test suite (`test/ddp_mock_server_test.dart`) that runs without a Meteor server or docker.
- Updated dependencies and lint rules (`lints` 6).
- BREAKING: `DdpClient.PING_SEC_INTERVAL` and `DdpClient.PONG_WITHIN_SEC` were renamed to the static constants `DdpClient.pingIntervalSeconds` and `DdpClient.pongTimeoutSeconds`.

# 4.0.0-beta.1, 4.0.0-beta.2
- Adding Web platform support by using the `web_socket_channel`.

Expand Down
Loading
Loading