diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-03-19 16:34:13 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-03-19 16:34:13 -0400 |
commit | 9e730b9a1aa4db311088a355e7e8601c6a998467 (patch) | |
tree | 286b56b8fe24a04c3c2a26f13d6fdc9c845d7452 /lib/js | |
parent | 1f530c51813cbeee1b166e5e75058eacb313f306 (diff) |
Dummy message delivery to clients
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 08d96040..9f93120f 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -174,3 +174,40 @@ function rc(uri, parse, k) { xhr.open("GET", uri, true); xhr.send(null); } + + +var client_id = 0; +var client_pass = 0; +var url_prefix = "/"; + +function path_join(s1, s2) { + if (s1.length > 0 && s1[s1.length-1] == '/') + return s1 + s2; + else + return s1 + "/" + s2; +} + +function listener() { + var xhr = getXHR(); + + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + var isok = false; + + try { + if (xhr.status == 200) + isok = true; + } catch (e) { } + + if (isok) + alert("Messages: " + xhr.responseText); + else { + alert("Error querying remote server for messages!"); + throw "Error querying remote server for messages!"; + } + } + }; + + xhr.open("GET", path_join(url_prefix, ".msgs/" + client_id + "/" + client_pass), true); + xhr.send(null); +} |