lib/faye/websocket/client.rb in faye-websocket-0.6.1 vs lib/faye/websocket/client.rb in faye-websocket-0.6.2
- old
+ new
@@ -23,9 +23,14 @@
port = @uri.port || (@uri.scheme == 'wss' ? 443 : 80)
EventMachine.connect(@uri.host, port, Connection) do |conn|
@stream = conn
conn.parent = self
end
+ rescue => error
+ event = Event.new('error')
+ event.init_event('error', false, false)
+ dispatch_event(event)
+ finalize(error.message, 1006)
end
private
def on_connect