-
Notifications
You must be signed in to change notification settings - Fork 69
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
self is dropped in the callbacks #21
Comments
Workaround is to set a |
sure. but first you somehow need to know the problem exists, it is not what you expect from a ruby code. I once lost 4 hours struggling to cope with the same bug in early rails... |
Dang, the same issue just got me. Thank you for the fix suggestion! That is a really annoying bug though. |
@sergeych This repository was moved ruby-jp/websocket-client-simple. If you still need this, make pull request or issue to ruby-jp/websocket-client-simple again, thx. |
It is actually a bug in the eventemitter gem, and serious one. Event callbacks for the socket are called on the wrong context, set by the emitter. It took me several hours to trace. I suggest to fix emitter or refrain of using it.
Sample:
`
me = self
@ws = WebSocket::Client::Simple.connect(ws_url)
@ws.on(:open) {
if me != self
puts "\n\n\nSelf is set to wrong in the callback in #{RUBY_VERSION}\n\n\n"
end
}
`
The text was updated successfully, but these errors were encountered: