Replace WebSocket with Ktor#318
Merged
LossyDragon merged 8 commits intoLongi94:masterfrom Feb 5, 2025
Merged
Conversation
…or remote disconnection or error occurs.
… down. Found ClientHeartBeat can ask for a reply which should help greatly.
… Skip tryMark if endPoint is null.
Use watchdog to check if Client or Session are still active, otherwise disconnect.
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.
Description
This PR replaces the kinda recent okhttp websocket approach with ktor's websocket.
The main issue with the current WSS (okhttp) handler was when steam goes down (like patch tuesdays), this would cause all sorts of issues with CMClient to reconnect or know if the disconnection was user initiated or not.
(side note: Steam doesn't broadcast when it does down on patch tuedays, the connections just so silent)
With Ktor, we're able to seperate the socket with coroutines for sending and receiving. Along with a watchdog to disconnect if a response doesnt happen within 30 seconds.
We can also have a ping/pong effect with CMsgClientHeartBeat by setting
sendReplyto true, keeping the watchdog at bay as it resets it's timer with every incoming message.Thanks to @rakosi2 for painstakingly testing
numeroussnapshots with their project to solve this issue (hopefully)I also noticed that processing large requests; such as many PICS requests, seem to be much faster. Not sure if this is Ktor or the WebSocket protocol for Steam, so I'll take that as a plus!
And with this, I think its time to release 1.6.0 since this was one of the long standing issues that held back the release.
Checklist