Commit cc2e8167 authored by Bas Lijnse's avatar Bas Lijnse

IO times are now updated when a client sends a ping command, and sessions are cleaned up earlier

because the pings keep active clients alive
parent bc88d541
......@@ -48,7 +48,7 @@ defaultEngineOptions world
, serverPort = IF_POSIX_OR_WINDOWS 8080 80
, serverUrl = "http://localhost/"
, keepaliveTime = 300 // 5 minutes
, sessionTime = 600 // 10 minutes
, sessionTime = 60 // 1 minute, (the client pings every 10 seconds by default)
, persistTasks = False
, autoLayout = True
, webDirPath = appDir </> appName +++ "-www"
......
......@@ -351,9 +351,13 @@ where
= (wsockTextMsg (toString json),False, instances, iworld)
// - Pings
(JSONArray [JSONInt commandId, JSONString "ping",_])
//TODO: Update timeout data for all instances
# json = JSONArray [JSONInt commandId, JSONString "ping", JSONObject []]
= (wsockTextMsg (toString json),False, instances, iworld)
= case updateInstanceLastIO (map fst instances) iworld of
(Error (_,err),iworld)
# json = JSONArray [JSONInt commandId, JSONString "exception",JSONObject [("description",JSONString err)]]
= (wsockTextMsg (toString json),False, instances, iworld)
(Ok (),iworld)
# json = JSONArray [JSONInt commandId, JSONString "ping", JSONObject []]
= (wsockTextMsg (toString json),False, instances, iworld)
//Unknown message
e
# json = JSONArray [JSONInt 0, JSONString "exception", JSONObject [("description",JSONString "Unknown command")]]
......@@ -376,7 +380,6 @@ where
= case changes of //Ignore empty updates
[] = ([],False,(clientname,state,instances),Nothing,iworld)
changes
# (_,iworld) = updateInstanceLastIO (map fst instances) iworld
# msgs =
[wsockTextMsg (toString (JSONArray [JSONInt 0,JSONString "ui-change"
,JSONObject [("instanceNo",JSONInt instanceNo),("change",encodeUIChange change)]])) \\ (instanceNo,change) <- changes]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment