/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (hide 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 andrew.betts 9 <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 andrew.betts 32 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 andrew.betts 9 }
21    
22     function startstream() {
23     streamreq = newXmlHttp();
24     byteoffset = 0;
25 andrew.betts 32 var url = parent.Meteor.getSubsUrl();
26 andrew.betts 9 streamreq.open("GET", url, true);
27 andrew.betts 32 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 andrew.betts 53 var x = newdata.indexOf("<s"+"cript>");
35 andrew.betts 32 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 andrew.betts 9
42 andrew.betts 32 // Last message is incomplete. Ignore it and it will be fetched again
43     break;
44     }
45 andrew.betts 9 } else {
46    
47 andrew.betts 32 // No more messages
48 andrew.betts 9 break;
49     }
50     }
51 andrew.betts 32 byteoffset = buffer.length-newdata.length;
52     } else if (streamreq.readyState == 4) {
53     delete streamreq;
54     if (typeof(r)=="function") {
55     r();
56     }
57 andrew.betts 9 }
58     }
59 andrew.betts 32 streamreq.send(null);
60 andrew.betts 9 }
61    
62 andrew.betts 32
63    
64 andrew.betts 9 startstream();
65     </script>
66     </body>
67 andrew.betts 3 </html>

  ViewVC Help
Powered by ViewVC 1.1.26