Skip to main content

MTE Relay mobile clients v5.3.1: Android, iOS and Flutter fixes

· 4 min read
Trevor Blackman
Engineering Director

Relay 5.3.1 is a patch release of the Android library, the iOS package and the Flutter plugin. It brings the two native libraries into line with each other and with the frame version 2 specification. It works with every v5 relay, and the relay needs no change. We recommend it for every app on 5.3.0.

Fixed on all three​

  • A body exactly at the relay's cap is sent. The client compared the encrypted frame with maxRequestBodyBytes, but the relay counts the body, so bodies from the cap down to about 0.4% under it were refused on the device. Only the body is compared now.
  • pathnamePrefix names where the relay is mounted, on both platforms. On Android, 5.0 to 5.3.0 added it to the encrypted path and sent the request to the root of the host, so a relay behind a proxy at /relay could not be reached. Requests now go to <server>/<prefix>/, as on iOS and in 4.x.
  • Long-lived sessions stay healthy. The client refreshes its token before the relay's tokenMaxAgeSeconds runs out. After a long sleep it notices that the relay has dropped its pairs and replaces them under the same client id, measuring on a clock that counts sleep. A manual re-pair hands the old pairs back to the relay instead of leaving them to age out.
  • The quick-starts said Kyber-512. The clients pair with Kyber-1024, as the relay requires.

Android​

  • callTimeout and call.cancel() now end a relayed request within about 100 ms, and fail with what OkHttp throws without a relay. That covers Retrofit and coroutine cancellation too.
  • maxPairs, minPairs and acquisitionWaitTime take effect. The pool grows on demand, and an open event stream no longer holds up other requests.
  • A body set with toRequestBody(mediaType) reaches the origin with its Content-Type, and repeated headers such as Set-Cookie keep every value.
  • Buffered requests and responses near the 64 MiB cap no longer run out of memory.

iOS​

  • Relay errors run their recovery again. A relay that no longer knows the session triggers a full repair instead of leaving the client broken until the app restarts. A refusal reports the relay's own status and reason, for example relayStatus(481, "body_too_large"), so it can be told apart from a proxy's 413.
  • A response cut short before the relay's END frame is a failure, not a complete body.
  • A relay host that does not resolve fails at once instead of waiting for connectivity. A quiet event stream lasts as long as the relay keeps it open.
  • The path reaches your API exactly as written, escapes and trailing slash included. Cancelling a transfer or hitting its timeout: stops it and frees its pair.

Flutter​

  • Errors are typed. RelayHttpClient, and Dio through it, throws RelayClientException, an http.ClientException that carries the status, the relay's reason and the RelayException. Existing on http.ClientException handlers still catch it.
  • startUpload and startDownload return an operation id on both platforms, and cancelOperation(id) stops that transfer.
  • The Android side no longer adds READ_PHONE_STATE and storage permissions to your app.

Upgrading​

Most apps need no code changes. Check these if they apply to you:

  • Android with pathnamePrefix: the prefix is now where the relay is mounted, not part of your request's path.
  • Flutter startUpload and startDownload: the future now resolves with the operation id when the transfer starts. The outcome arrives as a response or failed event.
  • iOS with a zero or negative timeout:: it now throws invalidConfiguration.
implementation("com.eclypses:mte-relay-client-android:5.3.1")
.package(url: "https://github.com/Eclypses/mte-relay-client-ios.git", from: "5.3.1")
mte_relay:
git:
url: https://github.com/Eclypses/relay-client-plugin-flutter.git
ref: v5.3.1

The plugin requires 5.3.1 of both native libraries. See the Android, iOS and Flutter guides, and each library's changelog on GitHub for the full list.