tj / axon

message-oriented socket library for node.js heavily inspired by zeromq
MIT License
1.5k stars 155 forks source link

SubEmitterSocket should apply listener with `self` rather than `this` #146

Closed lfk closed 9 years ago

lfk commented 9 years ago

Receiving a message via a SubSocket allows the user to access the underlying socket, whereas in SubEmitterSocket only the message buffer is exposed. I came across this inconsistency when I needed to access a publishing socket's identity from within a listener.

Please compare the suggested solution with the current implementation of SubSocket.prototype.onmessage.

jcrugzz commented 9 years ago

@lfk just address the one minor comment and this LGTM. A test would also be appreciated :)

lfk commented 9 years ago

@jcrugzz Removed the unused arg and added two tests (for pub/sub and emitter) that basically just check that this within the listeners is an instance of the corresponding socket type. Good to go? :)

jcrugzz commented 9 years ago

LGTM thanks @lfk

lfk commented 9 years ago

Thank you @jcrugzz! Just out of curiosity, when could we expect to see this available via npm?

jcrugzz commented 9 years ago

@lfk right now. 2.0.2

lfk commented 9 years ago

@jcrugzz Excellent! Thank you yet again. :)