diff options
author | 2009-03-19 16:34:13 -0400 | |
---|---|---|
committer | 2009-03-19 16:34:13 -0400 | |
commit | aa8373e15c46685b6d6a951342205fd28dc52f1a (patch) | |
tree | 286b56b8fe24a04c3c2a26f13d6fdc9c845d7452 /lib/js/urweb.js | |
parent | dabb624de9553e95431a22c70a9d707b02965711 (diff) |
Dummy message delivery to clients
Diffstat (limited to 'lib/js/urweb.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); +} |