blob: 1a466581178df7195a61ba37f01002a9a012a7a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
table boo : { Client : client, Channel : channel unit }
fun doIt () =
me <- self;
ch <- channel;
dml (INSERT INTO boo (Client, Channel) VALUES ({[me]}, {[ch]}));
return <xml><body onload={let
fun loop () =
v <- recv ch;
alert "Someone left";
loop ()
in
loop ()
end}/></xml>
task clientLeaves = fn cl =>
debug "Client left";
dml (DELETE FROM boo WHERE Client = {[cl]});
queryI (SELECT (boo.Channel)
FROM boo)
(fn r => send r.1 ());
debug "Done processing"
fun main () = return <xml><body>
<form> <submit action={doIt}/> </form>
</body></xml>
|