Skip to content
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

Strongly-typed circuit events. #704

Merged
merged 10 commits into from
Aug 9, 2023
Merged

Strongly-typed circuit events. #704

merged 10 commits into from
Aug 9, 2023

Conversation

bitbound
Copy link
Collaborator

@bitbound bitbound commented Aug 7, 2023

In Blazor Server, the front-end maintains a persistent SignalR connection to the backend, which is called a Circuit. By default, the circuit is "hidden" from the developer and handled behind-the-scenes by the framework. If you want to send your own SignalR messages, you'd need to create a new client connection that connects to a hub.

Alternatively, you can register your own CircuitHandler derivative, which allows you to add logic to the circuit. I opted for this route to reduce the number of connections. The CircuitConnection class is this custom CircuitHandler, which basically acts as a SignalR client.

The initially implementation was hasty and sloppy. The incoming events had loosely typed data (in the CircuitEvent class), all the front-end state was stored in a singular ClientAppState service, and reactivity was added via untyped property changed handlers.

This PR replaces the CircuitEvent with strongly-typed messages sent via IMessenger, and ClientAppState has been broken out into individual stores.


Please read the following. Do not delete below this line.

Thank you for your contribution to the Remotely project. It is required that contributors assign copyright to Immense Networks so we retain full ownership of the project.

This makes it easier for other entities to use the software because they only have to deal with one copyright holder. It also gives me assurance that we'll be able to make decisions in the future without gathering and consulting all contributors.

While this may seem odd, many open source maintainers practice this. Here are a couple well-known examples:

A nice article on the topic can be found here: https://haacked.com/archive/2006/01/26/WhoOwnstheCopyrightforAnOpenSourceProject.aspx/

By submitting this PR, you agree to the following:

You hereby assign copyright in this PR's code to the Remotely project and its copyright holder, Immense Networks, to be licensed under the same terms as the rest of the code. You agree to relinquish any and all copyright interest in the software, to the detriment of your heirs and successors.

colinblaise
colinblaise previously approved these changes Aug 8, 2023
Copy link

@colinblaise colinblaise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bitbound bitbound merged commit b1bf5f3 into master Aug 9, 2023
1 check passed
@bitbound bitbound deleted the tech/circuit-events branch August 9, 2023 18:41
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