comparison tests/ms.ur @ 1447:17393c5e2b90

Send newly created sources with messages to clients
author Adam Chlipala <adam@chlipala.net>
date Sat, 09 Apr 2011 20:00:52 -0400
parents
children
comparison
equal deleted inserted replaced
1446:36f7d1debb37 1447:17393c5e2b90
1 table ms : {Client : client, Channel : channel xbody}
2
3 val hitMe =
4 me <- self;
5 ch <- oneRowE1 (SELECT (ms.Channel)
6 FROM ms
7 WHERE ms.Client = {[me]});
8
9 s <- source 0;
10 send ch <xml>
11 <dyn signal={n <- signal s; return <xml>{[n]}</xml>}/>
12 <button value="Inc" onclick={n <- get s; set s (n + 1)}/>
13 </xml>
14
15 fun main' () =
16 me <- self;
17 ch <- channel;
18 dml (INSERT INTO ms (Client, Channel) VALUES ({[me]}, {[ch]}));
19
20 s <- source <xml/>;
21
22 return <xml><body onload={let
23 fun loop () =
24 x <- recv ch;
25 set s x;
26 loop ()
27 in
28 loop ()
29 end}>
30 <button value="Another" onclick={rpc hitMe}/>
31 <dyn signal={signal s}/>
32 </body></xml>
33
34 fun main () =
35 return <xml><body><form><submit action={main'}/></form></body></xml>