Skip to content

Introducing Scopes #102

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

Closed
wants to merge 19 commits into from
Closed

Introducing Scopes #102

wants to merge 19 commits into from

Conversation

aidanm3341
Copy link
Member

@aidanm3341 aidanm3341 commented Sep 3, 2024

I have added the concept of Scopes to the MessageBroker. This is a mechanism for building a tree of message brokers in which messages will propagate up the tree until either the root is reacher, or a broker is found which has a subscriber to handle the message.

One outstanding question on this implementation is if the semantics for disposing of a scope is complete. Currently you can .destroy() a broker, which will unlink it from its parent meaning messages will no longer propagate up. Should this functionality do anything else? E.g. should it unlink itself from any children scopes as well?

@Davidhanson90

This comment was marked as resolved.

@Davidhanson90

This comment was marked as resolved.

@aidanm3341

This comment was marked as resolved.

Roaders
Roaders previously approved these changes Oct 31, 2024
Davidhanson90

This comment was marked as resolved.

@aidanm3341

This comment was marked as resolved.

@aidanm3341 aidanm3341 changed the title Preliminary Scopes Implementation Introducing Scopes Feb 18, 2025
type Channels = (keyof typeof this.channelLookup)[];
(Object.keys(this.channelLookup) as Channels).forEach((channelName) => this.dispose(channelName));

if (this._parent) {

Choose a reason for hiding this comment

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

do we need to remove ourselves from the parents children array?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've currently got it set up so that there is no children's array anymore. Since messages only propagate up, I didn't have a use for storing children

@aidanm3341
Copy link
Member Author

I'm going to close this PR for now and reraise it later with some rewrites

@aidanm3341 aidanm3341 closed this May 23, 2025
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.

3 participants