       error: =>
         @_ajaxInitDone = true
         @_ajaxInitWorking = false
+
+        # try reconnect on error after x sec.
+        reconnect = =>
+          @_ajaxInit( force: true )
+        @delay reconnect, 10000, '_ajaxInit-reconnect-on-error', 'ws'
     )
 
   _ajaxSend: (data) =>

            message: 'No connection to websocket, trying to reconnect...'
          )
        if !@tryToConnect
          @delay message, 7000, 'websocket-no-connection-try-reconnect', 'ws'
        @tryToConnect = true

      # try reconnect after 4.5 sec.
      @delay @connect, 4500, undefined, 'ws'

    @ws.onerror = (e) =>
      @log 'Websocket', 'debug', "ws:onerror", e

    @log 'Websocket', 'debug', 'received websockend ping'

    # test again after 1 min
    @delay @ping, 60000, 'websocket-pong', 'ws'

  connect: =>
    return if @backend is 'ajax'
