Skip to content

Conversation

@simolus3
Copy link
Contributor

@simolus3 simolus3 commented Dec 1, 2025

On Apple platforms, NSURLSession is used to implement the HTTP client. That API does not support backpressure or pausing / resuming streamed HTTP responses (there are the suspend() and resume() method on download tasks, but these don't work).

As a fallback to avoid overloading slow clients, this brings back RSocket support over WebSockets. RSocket doesn't have this issue because clients explicitly request more frames that a server is allowed to send.
I see the fact that RSocket is used as an implementation detail, so there's no public API to enable or disable WebSockets. Instead, packages depending on the Darwin client implementation register a hook informing :common that backpressure is unsupported. When setting up the HTTP client, we then register WebSocket support and patch the frame size to ensure we can receive large messages.

For the websocket implementation, this essentially reverts #232.

I have tested that the JVM client continues to use regular HTTP. I've also tested the example multiplatform app in an iOS simulator to verify that websockets are used. Finally, I've synced a large row (inserted a Postgres value as repeat('A', 10485760) to create a 10MiB row) to verify that RSocket framing / custom max websocket frame sizes for Darwin works (which required updating ktor to the latest version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants