22require 'async/websocket'
33require 'async/notification'
44require 'async/clock'
5+ require 'io/endpoint/host_endpoint'
6+ require 'io/endpoint/ssl_endpoint'
57
68module Slack
79 module RealTime
@@ -47,10 +49,10 @@ def start_reactor(client)
4749 @client_task = task . async do |subtask |
4850 subtask . annotate "#{ client } run-loop"
4951 client . run_loop
50- rescue ::Async ::Wrapper :: Cancelled => e
52+ rescue ::Async ::Timeout :: CancelledError => e
5153 # Will get restarted by ping worker.
5254 rescue StandardError => e
53- client . logger . error ( subtask . to_s ) { e . message }
55+ client . logger . error ( subtask . to_s ) { e . message + " \n \t " + e . backtrace . join ( " \n \t " ) }
5456 end
5557
5658 @restart . wait
@@ -115,8 +117,8 @@ def build_ssl_context
115117 end
116118
117119 def build_endpoint
118- endpoint = ::Async :: IO ::Endpoint . tcp ( addr , port )
119- endpoint = ::Async :: IO ::SSLEndpoint . new ( endpoint , ssl_context : build_ssl_context ) if secure?
120+ endpoint = ::IO ::Endpoint . tcp ( addr , port )
121+ endpoint = ::IO :: Endpoint ::SSLEndpoint . new ( endpoint , ssl_context : build_ssl_context ) if secure?
120122 endpoint
121123 end
122124
@@ -134,9 +136,9 @@ def connect
134136 end
135137end
136138
137- if Gem ::Version . new ( Async ::WebSocket ::VERSION ) >= Gem ::Version . new ( '0.9.0' )
139+ if Gem ::Version . new ( Async ::WebSocket ::VERSION ) < Gem ::Version . new ( '0.9.0' )
138140 raise (
139141 "Incompatible version of async-websocket, #{ Async ::WebSocket ::VERSION } , " \
140- "use \" gem 'async-websocket', '~> 0.8.0 '\" ."
142+ "use the latest \" gem 'async-websocket'\" and \" gem 'io-endpoint '\" ."
141143 )
142144end
0 commit comments