summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2016-06-16 11:00:01 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2016-06-16 11:00:01 -0400
commitf050c7f1de1fe03e2253f408445a69e9402f60ee (patch)
treeca6e66fda36d8445e34ba396394ba5a3dcfa1a39 /tests
parent6dad7c645d8fdb7b7237c89ff7b34e90adbb86b1 (diff)
Client-side: detect session timeout and ask the user to reload
Diffstat (limited to 'tests')
-rw-r--r--tests/timeout.ur22
-rw-r--r--tests/timeout.urp7
-rw-r--r--tests/timeout.urs1
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/timeout.ur b/tests/timeout.ur
new file mode 100644
index 00000000..d96b42bd
--- /dev/null
+++ b/tests/timeout.ur
@@ -0,0 +1,22 @@
+table listeners : { Ch : channel unit }
+
+fun ping () =
+ queryI1 (SELECT * FROM listeners)
+ (fn r => send r.Ch ())
+
+fun main () =
+ ch <- channel;
+ dml (INSERT INTO listeners(Ch) VALUES ({[ch]}));
+ count <- source 0;
+ return <xml><body onload={let
+ fun loop () =
+ _ <- recv ch;
+ c <- get count;
+ set count (c + 1);
+ loop ()
+ in
+ loop ()
+ end}>
+ <dyn signal={n <- signal count; return (txt n)}/>
+ <button onclick={fn _ => rpc (ping ())}>Ping</button>
+ </body></xml>
diff --git a/tests/timeout.urp b/tests/timeout.urp
new file mode 100644
index 00000000..6d3ca878
--- /dev/null
+++ b/tests/timeout.urp
@@ -0,0 +1,7 @@
+timeout 2
+rewrite url Timeout/*
+database dbname=test
+sql timeout.sql
+safeGet main
+
+timeout
diff --git a/tests/timeout.urs b/tests/timeout.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/timeout.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page