This release brings WebSocket related improvements, support for HMPP, and a some performance improvements and bug fixes!
✨️ [new] WebSocketNetworkTransport.closeConnection
(#4049)
This new method can be used in conjunction with reopenWhen
to force a reconnection to the server. This could be useful for instance when needing to pass new auth tokens in the headers. If you were using subscriptionManager.reconnect()
in 2.x, closeConnection
is a simple way to achieve the same behaviour.
✨️ [new] GraphQLWsProtocol.connectionPayload
is now a lambda (#4043)
With GraphQLWsProtocol
, if you need to pass parameters to the connection payload, previously you would pass them as a static map to the builder. With this change you can now pass a lambda providing them as needed. This facilitates passing fresh auth tokens when connecting.
✨️ [new] Hierarchical MultiPlatform Project (HMPP) (#4033)
When using Apollo Kotlin on a multiplatform project, this release is compatible with the hierarchical project structure, which makes it easier to share common code among several targets. Using HMPP in your project also fixes some issues when compiling Kotlin metadata. See #4019 and https://youtrack.jetbrains.com/issue/KT-51970/ for more details.
Note: if your project doesn’t yet use Kotlin 1.6.20+ (which automatically enables HMPP) we recommend you update to it, otherwise you may hit this issue.
✨️ [new] Add insecure option to download schema (#4021)
You can now use the --insecure
flag when downloading a schema with downloadApolloSchema
, to bypass the certificate check, which can be useful if a server is configured with a self-signed certificate for instance.
👷 All changes
- Add WebSocketNetworkTransport.closeConnection (#4049)
- Made connectionPayload as suspend function in GraphQLWsProtocol (#4043)
- ⚡ Ignore unknown websocket messages (#4066)
- Kotlin 1.6.21 & HMPP (#4033)
- Provide a Content-Length when using Upload (#4056)
- ☁️ add HttpRequest.newBuilder(url, method) (#4038)
- Escape enum constants (#4035)
- Fix the Moshi adapter used for OperationOutput. Moshi cannot get the type parameters from the typealias
automagically (#4022) - Add insecure option to download schema (#4021)
- Try to reduce allocations in MapJsonReader (#3935)
- 🔒 Deprecate BearerTokenInterceptor and provide tests and docs instead (#4068)
❤️ External contributors
Many thanks to @CureleaAndrei and @kdk96 for contributing to this release! 🙏
⚙️ Deprecations
BearerTokenInterceptor
was provided as an example but is too simple for most use cases, and has therefore been deprecated
in this release. This page provides more details
about authentication.- The previous ways of passing parameters to the connection payload with
GraphQLWsProtocol
has been deprecated (see above).