This PR changes this to bind to session object when we call emit from C++ to JS land.
As part of the re-factoring JS code we found that the emit function was called in JS land with this bind to the global context. This does not work well with node EventEmitter implementation unless you bind this back to the session object explicitly(use .bind() or closure).
This PR changes
this
to bind tosession
object when we callemit
from C++ to JS land.As part of the re-factoring JS code we found that the
emit
function was called in JS land withthis
bind to theglobal
context. This does not work well with nodeEventEmitter
implementation unless you bindthis
back to thesession
object explicitly(use.bind()
or closure).