We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Blocks that were provided to the EventEmmiter as callbacks are evaluated inside the Client class. It's easy to check:
ws.on :open do puts self end
Will output:
#<WebSocket::Client::Simple::Client:0x007f890bc50698>
So code like follows wont work:
state = :initial ws.on :open do state = :connected end
What's the convenient way to access the initial environment where the block was created?
The text was updated successfully, but these errors were encountered:
Maybe this way:
state = :initial set_state = ->(s) { state = s } ws.on :open do set_state.call(:connected) end
It works because lambda catchs current environment, and inside lamda block will be the old receiver.
Sorry, something went wrong.
@sadovnik 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.
No branches or pull requests
Blocks that were provided to the EventEmmiter as callbacks are evaluated inside the Client class. It's easy to check:
Will output:
So code like follows wont work:
What's the convenient way to access the initial environment where the block was created?
The text was updated successfully, but these errors were encountered: