-
Notifications
You must be signed in to change notification settings - Fork 42
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
Make WakuRelay
API closer to EventEmitter
#678
Comments
The work done in waku-org/js-noise#14 enables us to already improve the API for a concrete use case. Iceboxing for now until we have a concrete need or request of API from developers. |
@fryorcraken I think current issue lost it's actuality to #1635 so it should be safe to close this one |
#1635 is more around wrappers. However, happy to close this and just track work based on recent/popular developer feedback. |
This is a feature request
Problem
The
WakuRelay
API implements the observer design pattern.It is reminiscent of NodeJS's
EventEmitter
, which is a popular interface in the JS that also implement the observer design pattern:WakuRelay
EventEmitter
send
emit
addObserver
on
deleteObserver
removeListener
However,
WakuRelay
's API is very limited in comparison toEventEmitter
.See https://nodejs.org/api/events.html for details.
When implementing a socket-like usage of js-waku for WebRTC, I have found the lack of
once
andremoveAllListeners
limiting.Note: the API does not use the same function names because
WakuRelay
extendsEventEmitter
by transition.Proposed Solutions
Implement the following methods on
WakuRelay
:WakuRelay
EventEmitter
equivalentaddOnceObserver
once
removeAllObservers
removeAllListeners
Feel free to implement all methods equivalent but having check I am uncertain there other methods worth it apart from prepend and count.
The text was updated successfully, but these errors were encountered: