/[meteor]/googlecode.com/svn/trunk/public_html/stream.html
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /googlecode.com/svn/trunk/public_html/stream.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (show annotations)
Wed Feb 27 21:58:56 2008 UTC (16 years, 1 month ago) by andrew.betts
File MIME type: text/html
File size: 1629 byte(s)
Updated version number

JS client:
Added channel info handler to JS client, assumes Meteor will send <script>ch('channel', msgid);</script>
Allowed processing of messages prior to current message index
Added disconnect() to eof()
Revert to poll mode if unable to load frame (should fix IE proxy issues)

Server:
Fixed output of channel info to show only subscribed channels (and simplified)
Added logging of IP addresses

1 <html>
2 <body>
3 <script type="text/javascript">
4 window.onError = null;
5 var domainparts = document.domain.split(".");
6 document.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];
7 parent.Meteor.register(this);
8 var streamreq;
9 var byteoffset;
10
11 function abort() {
12 streamreq.abort();
13 }
14
15 function newXmlHttp() {
16 try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
17 try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
18 try { return new XMLHttpRequest(); } catch(e) {}
19 return null;
20 }
21
22 function startstream() {
23 streamreq = newXmlHttp();
24 byteoffset = 0;
25 var url = parent.Meteor.getSubsUrl();
26 streamreq.open("GET", url, true);
27 streamreq.onreadystatechange = function() {
28 if (typeof streamreq == "undefined") return;
29 if (streamreq.readyState == 3) {
30 var buffer = streamreq.responseText;
31 var newdata = buffer.substring(byteoffset);
32 byteoffset = buffer.length;
33 while (1) {
34 var x = newdata.indexOf("<s"+"cript>");
35 if (x != -1) {
36 y = newdata.indexOf("</"+"script>", x);
37 if (y != -1) {
38 eval(newdata.substring((x+8),y));
39 newdata = newdata.substring(y+9);
40 } else {
41
42 // Last message is incomplete. Ignore it and it will be fetched again
43 break;
44 }
45 } else {
46
47 // No more messages
48 break;
49 }
50 }
51 byteoffset = buffer.length-newdata.length;
52 } else if (streamreq.readyState == 4) {
53 delete streamreq;
54 if (typeof(r)=="function") {
55 r();
56 }
57 }
58 }
59 streamreq.send(null);
60 }
61
62
63
64 startstream();
65 </script>
66 </body>
67 </html>

  ViewVC Help
Powered by ViewVC 1.1.26