Explorar el Código

use browser 'online' event to trigger reconnect

Brian Gough hace 10 años
padre
commit
2a8efea29a

+ 6 - 0
services/web/public/coffee/ide/connection/ConnectionManager.coffee

@@ -20,6 +20,12 @@ define [], () ->
 				@disconnectIfInactive()
 			, ONEHOUR)
 
+			# trigger a reconnect immediately if network comes back online
+			window.addEventListener 'online', =>
+				sl_console.log "[online] browser notified online"
+				if !@connected
+					@tryReconnectWithRateLimit({force:true})
+
 			@userIsLeavingPage = false
 			window.addEventListener 'beforeunload', =>
 				@userIsLeavingPage = true