lib/ruboty/slack_rtm/client.rb in ruboty-slack_rtm-2.5.0 vs lib/ruboty/slack_rtm/client.rb in ruboty-slack_rtm-2.5.1

- old
+ new

@@ -50,12 +50,15 @@ def create_client(url) WebSocket::Client::Simple.connect(url, verify_mode: OpenSSL::SSL::VERIFY_PEER).tap do |client| client.on(:error) do |err| Ruboty.logger.error("#{err.class}: #{err.message}\n#{err.backtrace.join("\n")}") end + queue = @queue client.on(:close) do Ruboty.logger.info('Disconnected') - @queue.enq(CONNECTION_CLOSED) + # XXX: This block is called via BasicObject#instance_exec from + # EventEmitter, so `@queue` isn't visible here. + queue.enq(CONNECTION_CLOSED) end end end def keep_connection