-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket server #4130
Open
austinmilt
wants to merge
7
commits into
TASEmulators:master
Choose a base branch
from
austinmilt:amilt/websocket-server
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
websocket server #4130
Conversation
This file contains 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
austinmilt
commented
Dec 3, 2024
// this could happen if, for instance, the client sent a registration request to the echo topic, such | ||
// that we tried to access the wrong field of the wrapper | ||
// TODO proper logging | ||
Console.WriteLine("Error handling message {0}", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would appreciate advice on how to properly do logging (both debug and otherwise)
austinmilt
commented
Dec 3, 2024
: null | ||
); | ||
// TODO better place to put the start of the server? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would appreciate advice here
2 tasks
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.
This PR adds a base websocket server implementation, to be used for two-way JSON-based communication with clients in both event broadcasting and request/response messaging, such as to send commands to the emulator. The implementation is meant to stand alongside the existing
SocketServer
(more performant, lower-level, less dev friendly) and the websocket "server" (renamed toWebSocketClient
) which is actually a client implementation for connecting to and sending messages to external websocket servers.Some notes on the implementation:
registration
-specific message lives under theregistration
field of the wrapper). The primary advantage here is that clients can use a single implementation to serialize/deserialize all messages in a single pass over the JSON.Main Changes
WebSocketServer
toWebSocketClient
to match its usage, and make room for the new websocket server added here (WebSocketClient
,CommApi
)WebSocketServer
)Registration.cs
), echo for debugging (Echo.cs
), and generic errors (Error.cs
) - which are wrapped in wrappers described above (MessageWrapper.cs
) and described by their topic enum (MessageWrapper
).ArgParser
,IMainFormForApi
,ParsedCLIFlags
,MainForm
,CommApi
) and use these to initialize the server (MainForm
)Check if completed: