-
Notifications
You must be signed in to change notification settings - Fork 375
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
events? #643
Comments
You definitely need the ability to both subscribe and unsubscribe at any point in time. That pretty much leads you to needing the equivalent of EventEmitter. So why not use that since it pretty much is an established standard? |
One thing I'ld say is that plugins should not emit events through the client instance: that quickly can lead to naming conflicts. |
I'm not convinced, do you have use cases in mind? XMPP is stateful, from experience this usually happens at protocol level. (Pubsub
Yep definitely, that's how "plugins" are designed already, separate objects. |
Yes: React components. They must unsubscribe when they are unmounted. |
see #642 for background story
Similar story, I'm looking for feedback in how to design events in "higher level" packages such as roster and pubsub.
I'm not a big fan of using EventEmitter for this as we already have a middleware api that we could re-use. iqCallee is build on top and act as a router. It handles errors/exceptions automatically and its interface is compatible with servers.
There are 2 kinds of events in XMPP, events that require an ack (iq) and events that don't (message and presence).
Let's take roster as an example for the first, this is what it would look like with using iqCallee/middleware API:
Let's take pubsub as an example for the second use case:
cc @ggozad
cc @wichert
The text was updated successfully, but these errors were encountered: