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

Add ability to emit client <-> server events #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Dec 15, 2015

This adds the primus-emit functionality to the SubStream instance.

I don't like the fact that it uses a trigger method instead of the usual emit, but I tried to override the emit method and it broke the tests.

cc: @3rd-Eden @siddo420

@3rd-Eden
Copy link
Member

The trigger name though.. yuk. It triggers my OCD hard especially because we already have primus-emit that just uses emit for the event emitting. So this introduces a different API for emitting and when you pair substream with primus-emit you end up with really odd code.

@lpinca
Copy link
Member Author

lpinca commented Dec 17, 2015

I totally agree :/

@lpinca
Copy link
Member Author

lpinca commented Dec 17, 2015

Maybe we can remove the trigger method and document that if you want to trigger an even on the substream you can use something like this:

substream._write({ emit: [ eventName, arg ] });

but I don't know if it is any better, it's cumbersome and uses the private _write method.

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.

2 participants