From f884ad12f4062eb85c35fe222c97695fd25f93e4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 6 Aug 2012 06:36:57 +0200 Subject: [PATCH] Added connection ping feature. --- app/assets/javascripts/app/lib/websocket.js.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/app/lib/websocket.js.coffee b/app/assets/javascripts/app/lib/websocket.js.coffee index 3d51fe09b..c1b6b86d1 100644 --- a/app/assets/javascripts/app/lib/websocket.js.coffee +++ b/app/assets/javascripts/app/lib/websocket.js.coffee @@ -56,19 +56,19 @@ class _Singleton extends Spine.Controller console.log 'send websockend ping' @send( { action: 'ping' } ) - # check if ping is back within 30 sec. + # check if ping is back within 2 min if @check_id clearTimeout(@check_id) check = => console.log 'no websockend ping response, reconnect...' @close() - @check_id = @delay check, 60000 + @check_id = @delay check, 120000 pong: -> console.log 'received websockend ping' - # test again after 10 sec. - @delay @ping, 30000 + # test again after 1 min + @delay @ping, 60000 connect: => # console.log '------------ws connect....--------------' @@ -103,7 +103,7 @@ class _Singleton extends Spine.Controller @queue = [] # send ping to check connection - @delay @ping, 30000 + @delay @ping, 60000 @ws.onmessage = (e) => pipe = JSON.parse( e.data )