Use Java socket by default for RTMP#2100
Open
mkrn wants to merge 2 commits into
Open
Conversation
This was referenced Jun 3, 2026
Owner
|
Hello, Thank you for the reports. I added 2 comments to the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change the default RTMP socket implementation from Ktor to Java sockets. Ktor remains available via
setSocketType(SocketType.KTOR), but newRtmpClientinstances default toSocketType.JAVA.Why
The Ktor RTMPS path can crash the app when the network is interrupted or the remote peer closes the connection while TLS is shutting down. We reproduced this in a production app by streaming to an
rtmps://endpoint, disabling Wi-Fi during the stream, and watching the process crash from Ktor's internal TLS closer coroutine.Observed crash shape:
This is consistent with #1856 and #2085. In #1856, Java sockets were suggested as the workaround and as a possible safer default. In our device test, switching RTMP to
SocketType.JAVAstopped the fatal process crash while preserving reconnect behavior.Verification
./gradlew :rtmp:assemblertmps://endpoint:Compatibility
This preserves the public API and keeps Ktor opt-in through
setSocketType(SocketType.KTOR). The change only affects the default for RTMP clients.Related: #1856, #2085