Websocket refactoring and improvements - #35
Merged
Merged
Conversation
kickhead13
approved these changes
Dec 3, 2025
kickhead13
left a comment
Member
There was a problem hiding this comment.
holy FUCK this is cool. Lers get this merged
kickhead13
requested changes
Dec 3, 2025
kickhead13
left a comment
Member
There was a problem hiding this comment.
Let's try to move the websockets stuff into its own file.
kickhead13
approved these changes
Dec 4, 2025
kickhead13
left a comment
Member
There was a problem hiding this comment.
I found a weird issue on Ubuntu X11 i3WM running tauri ontop of webkit. I will be creating a github issue for this and we will investigate it.
I approve this change as is.
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.
In this PR, the following changes were made to the websocket implementation:
* Extracted the WS initialization procedure from the data() function to its own methodinitWebsocketwhich is called from the data function instead.wsConnectionclass.wsConnectionemits events when requiring the main application to complete a token exchange/handshake with od-spell-caster (when first opening the app, or when connection is temporarily lost)wsConnectionwill forward all message-received events to the main app for decoding.wsConnectionis fully autonomous as long as handshake requests are properly handled. The main app binds towsConnectiononce and doesn't need to keep track of web sockets opening or closing when connection is lost and restored.Minor: Minutes are now padded properly (ex. 18:6 -> 18:06)
Because this is a relatively complicated architecture (compared to the rest of the frontend) I'll include the following diagram to help understand the sequence

of events: