 
     # Currently logged in user.
     user = null
+
+    backOff = new BackOff 'fibonacci', 5e3
+    backOff.waitAtMost 900e3 # 15 minutes.
 
     # Function used to send requests when the socket is opened.
     send = (method, params, deferred) ->

      # success: notifier 'success'
    }

  .service 'xoApi', ($cookieStore, $location, $q, $timeout, notify) ->
    url = do ->
      # Note: The path is ignored, the WebSocket must be relative to
      # root.

        # New requests are sent directly.
        call = send

      socket.addEventListener 'close', -> backOff.backOff()

      # When a message is received, we call the corresponding
      # deferred (if any).
