Mercurial > urweb
comparison lib/js/urweb.js @ 667:a93d5324f400
Dummy message delivery to clients
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 19 Mar 2009 16:34:13 -0400 |
parents | 96ebc6bdb5a0 |
children | b0c1a46b1f15 |
comparison
equal
deleted
inserted
replaced
666:5130228d2b29 | 667:a93d5324f400 |
---|---|
172 }; | 172 }; |
173 | 173 |
174 xhr.open("GET", uri, true); | 174 xhr.open("GET", uri, true); |
175 xhr.send(null); | 175 xhr.send(null); |
176 } | 176 } |
177 | |
178 | |
179 var client_id = 0; | |
180 var client_pass = 0; | |
181 var url_prefix = "/"; | |
182 | |
183 function path_join(s1, s2) { | |
184 if (s1.length > 0 && s1[s1.length-1] == '/') | |
185 return s1 + s2; | |
186 else | |
187 return s1 + "/" + s2; | |
188 } | |
189 | |
190 function listener() { | |
191 var xhr = getXHR(); | |
192 | |
193 xhr.onreadystatechange = function() { | |
194 if (xhr.readyState == 4) { | |
195 var isok = false; | |
196 | |
197 try { | |
198 if (xhr.status == 200) | |
199 isok = true; | |
200 } catch (e) { } | |
201 | |
202 if (isok) | |
203 alert("Messages: " + xhr.responseText); | |
204 else { | |
205 alert("Error querying remote server for messages!"); | |
206 throw "Error querying remote server for messages!"; | |
207 } | |
208 } | |
209 }; | |
210 | |
211 xhr.open("GET", path_join(url_prefix, ".msgs/" + client_id + "/" + client_pass), true); | |
212 xhr.send(null); | |
213 } |