-
-
Notifications
You must be signed in to change notification settings - Fork 753
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
Fix duplicate events in dynamic services. #115
Conversation
0ff943c
to
cbdd7d1
Compare
Are you sure this is the best solution? I would think we just don't need to call |
Alternatively we can remove applyEvents and move this line: https://github.com/feathersjs/feathers/blob/master/lib/application.js#L54 You think that's a better solution? |
You could just update this PR by pushing to the |
cbdd7d1
to
af46b13
Compare
Just so you could see the diff. Not trying to insult your intelligence. :) |
I was thinking of leaving it the other way in preparation for allowing providers to be registered at any time and making a single pathway for registering services instead of the duality going on right now with setup() and addService(). It's not that big of a change though, so it doesn't really matter. |
af46b13
to
08f347a
Compare
I will have another look. I feel that there there is a good single way of doing this. Maybe you are right and mixins are not the way to go here. |
I did some refactoring in https://github.com/feathersjs/feathers/blob/ffb603a4d8be2b309f26ad2e449611f8f94f9993/lib/providers/socket/commons.js that should handle both kinds of services properly and also made the socket handlers a little shorter and moved the dynamic service tests into nested describes. Can you double check if that solves all the issues and also makes sense? |
Ahh... Yes. That is so much cleaner and solves the issue. |
ffb603a
to
b368eef
Compare
Fix duplicate events in dynamic services.
client should return a 401 error code when no token is provided
client should return a 401 error code when no token is provided
After fixing setup() for dynamic services in the last PR (#110), the events mixin's setup() function was adding duplicate events. This PR wraps
applyEvents
with anif (!this._serviceEvents) { ... }
check to assure it isn't adding events twice.