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

Extend NetworkBehaviourAction to add and remove listeners #3291

Closed
dariusc93 opened this issue Dec 30, 2022 · 1 comment · Fixed by #3292
Closed

Extend NetworkBehaviourAction to add and remove listeners #3291

dariusc93 opened this issue Dec 30, 2022 · 1 comment · Fixed by #3292

Comments

@dariusc93
Copy link
Member

Description

Extend NetworkBehaviourAction with NetworkBehaviourAction::ListenOn and NetworkBehaviourAction::RemoveListener to allow adding or removing a listener within the NetworkBehaviour

Motivation

One project that I am working on is an attempt at connecting to a relay automatically, which could benefit from this by emitting an event to listen on the relay and be able to remove it by using the listener id later if needed (eg relay becoming unreliable). Current workaround is emitting an event which is then seen when polling the swarm to then listen to (and soon remove) the address there.

Open questions

Are you planning to do it yourself in a pull request?

Maybe

@thomaseizinger
Copy link
Contributor

Related: #3040

I am in favor of this, I think it makes sense to offer all capabilities through NetworkBehaviour and slowly but surely shrink the public API of Swarm.

@mergify mergify bot closed this as completed in #3292 Jun 9, 2023
mergify bot pushed a commit that referenced this issue Jun 9, 2023
This extends `ToSwarm` to add `ToSwarm::ListenOn` and `ToSwarm::RemoveListener`, which allows creating and removing listeners from a `NetworkBehaviour`.

Resolves #3291.

Pull-Request: #3292.
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 a pull request may close this issue.

2 participants