From 2686b579382e7b7959a7d930de4b0616981b570b Mon Sep 17 00:00:00 2001 From: Matt Diebolt Date: Tue, 9 May 2017 14:23:59 -0700 Subject: [PATCH] Send more info on disconnected event --- lib/firehose/consumer.coffee | 7 ------- lib/firehose/long_poll_transport.coffee | 2 +- lib/firehose/transport.coffee | 4 ++-- lib/firehose/web_socket_transport.coffee | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/firehose/consumer.coffee b/lib/firehose/consumer.coffee index d8bed58..5dfc871 100644 --- a/lib/firehose/consumer.coffee +++ b/lib/firehose/consumer.coffee @@ -83,13 +83,6 @@ class Consumer @config.connected = origConnected origConnected() - # origDisconnected = @config.disconnected - # @config.disconnected = => - # deferred.reject() - # if origDisconnected - # @config.disconnected = origDisconnected - # origDisconnected() - deferred.promise() Consumer.multiplexChannel = "channels@firehose" diff --git a/lib/firehose/long_poll_transport.coffee b/lib/firehose/long_poll_transport.coffee index 4b228a8..f399b38 100644 --- a/lib/firehose/long_poll_transport.coffee +++ b/lib/firehose/long_poll_transport.coffee @@ -108,7 +108,7 @@ class LongPollTransport extends Transport unless @_needToNotifyOfReconnect or @_stopRequestLoop @_needToNotifyOfReconnect = true - @config.disconnected() + @config.disconnected(jqXhr, status, error) unless @_stopRequestLoop # Ping the server to make sure this isn't a network connectivity error setTimeout @_ping, @_retryDelay + @_lagTime diff --git a/lib/firehose/transport.coffee b/lib/firehose/transport.coffee index 4c4c959..fbaa352 100644 --- a/lib/firehose/transport.coffee +++ b/lib/firehose/transport.coffee @@ -26,7 +26,7 @@ class Transport _error: (event) => if @_succeeded # Lets try to connect again with delay - @config.disconnected() + @config.disconnected event @connect(@_retryDelay) else @config.failed event @@ -37,7 +37,7 @@ class Transport # Default connection closed handler _close: (event) => - @config.disconnected() + @config.disconnected event # Useful for reconnecting after any networking hiccups getLastMessageSequence: => diff --git a/lib/firehose/web_socket_transport.coffee b/lib/firehose/web_socket_transport.coffee index 2f9f727..9adc543 100644 --- a/lib/firehose/web_socket_transport.coffee +++ b/lib/firehose/web_socket_transport.coffee @@ -90,7 +90,7 @@ class WebSocketTransport extends Transport @_cleanUp() if @_needToNotifyOfDisconnect @_needToNotifyOfDisconnect = false - @config.disconnected() + @config.disconnected event if @_succeeded @connect @_retryDelay else if @config.failed