     # initial connect
     @connect()
 
+    # send ping after visibilitychange to check if connection is open again after wakeup
+    $(document).bind('visibilitychange', =>
+      console.log('visibilitychange')
+      return if document.hidden
+      return if !@connectionEstablished
+      console.log('ping')
+      @ping()
+    )
+
   channel: ->
     @backend
 


    @log 'debug', 'received websocket pong'

    # test again after 1 min
    App.Delay.set(@ping, 60000, 'websocket-pong', 'ws')

  connect: =>

    @log 'debug', 'send websocket ping'
    @send(event: 'ping')

    # check if ping is back within 90 sec
    App.Delay.clear 'websocket-ping-check', 'ws'
    check = =>
      @log 'debug', 'no websocket ping response, reconnect...'
