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

Diff of /googlecode.com/svn/trunk/public_html/meteor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by andrew.betts, Mon May 14 15:32:03 2007 UTC revision 23 by andrew.betts, Sun May 20 14:03:10 2007 UTC
# Line 46  function Meteor(instID) { Line 46  function Meteor(instID) {
46          this.pollfreq = 2000;          this.pollfreq = 2000;
47          this.minpollfreq = 2000;          this.minpollfreq = 2000;
48          this.mode = "poll";          this.mode = "poll";
49          this.polltimeout=30000;          this.polltimeout = 30000;
50          this.pingtimeout = 10000;          this.pingtimeout = 10000;
51          this.maxmessages = 0;          this.maxmessages = 0;
52          this.status = 0;          this.status = 0;
# Line 115  Meteor.prototype.start = function() { Line 115  Meteor.prototype.start = function() {
115          var now = new Date();          var now = new Date();
116          var t = now.getTime();          var t = now.getTime();
117          this.setstatus(1);          this.setstatus(1);
118          var surl = "http://" + this.subdomain + "." + location.hostname + "/" + this.dynamicpageaddress + "?id=" + this.MHostId;          this.updateSubsUrl();
         if (this.maxmessages && !this.persist) surl += "&maxmessages=" + this.maxmessages;  
         for (var c in this.channels) {  
                 surl += "&channel="+c;  
                 if (this.channels[c].lastmsgreceived > 0) {  
                         surl += "&restartfrom="+this.channels[c].lastmsgreceived;  
                 } else if (this.channels[c].backtrack > 0) {  
                         surl += "&backtrack="+this.channels[c].backtrack;  
                 } else if (this.channels[c].backtrack < 0 || isNaN(this.channels[c].backtrack)) {  
                         surl += "&restartfrom=";  
                 }  
         }  
         this.subsurl = surl;  
119          if (this.mode=="stream") {          if (this.mode=="stream") {
120                  if (document.all) {                  if (document.all) {
121                          this.createIframe(this.subsurl);                          this.createIframe(this.subsurl);
# Line 139  Meteor.prototype.start = function() { Line 127  Meteor.prototype.start = function() {
127                  this.pingtimer = setTimeout(f, this.pingtimeout);                  this.pingtimer = setTimeout(f, this.pingtimeout);
128    
129          } else {          } else {
130                  this.createIframe("http://"+this.subdomain+"."+location.hostname+"/poll.html");                  this.createIframe("http://"+this.subdomain+"."+location.hostname+"/poll.html&nc="+t);
131                  this.recvtimes[0] = t;                  this.recvtimes[0] = t;
132                  if (this.updatepollfreqtimer) clearTimeout(this.updatepollfreqtimer);                  if (this.updatepollfreqtimer) clearTimeout(this.updatepollfreqtimer);
133                  this.updatepollfreqtimer = setInterval(this.updatepollfreq.bind(this), 2500);                  this.updatepollfreqtimer = setInterval(this.updatepollfreq.bind(this), 2500);
# Line 147  Meteor.prototype.start = function() { Line 135  Meteor.prototype.start = function() {
135          this.lastrequest = t;          this.lastrequest = t;
136  }  }
137    
138    Meteor.prototype.updateSubsUrl = function() {
139            var surl = "http://" + this.subdomain + "." + location.hostname + "/" + this.dynamicpageaddress + "?id=" + this.MHostId;
140            if (this.maxmessages && this.persist && this.mode != "stream") surl += "&maxmessages=" + this.maxmessages;
141            if (this.mode == "poll" && this.maxmessages == 0 && this.persist==1) this.persist=0;
142            surl += "&persist="+this.persist;
143            for (var c in this.channels) {
144                    surl += "&channel="+c;
145                    if (this.channels[c].lastmsgreceived > 0) {
146                            surl += "&restartfrom="+(this.channels[c].lastmsgreceived+1);
147                    } else if (this.channels[c].backtrack > 0) {
148                            surl += "&backtrack="+this.channels[c].backtrack;
149                    } else if (this.channels[c].backtrack < 0 || isNaN(this.channels[c].backtrack)) {
150                            surl += "&restartfrom=";
151                    }
152            }
153            this.subsurl = surl;
154    }
155    
156  Meteor.prototype.createIframe = function(url) {  Meteor.prototype.createIframe = function(url) {
157          if (document.all) {          if (document.all) {
158                  this.transferDoc = new ActiveXObject("htmlfile");                  this.transferDoc = new ActiveXObject("htmlfile");
# Line 223  Meteor.prototype.process = function(id, Line 229  Meteor.prototype.process = function(id,
229                          while (this.recvtimes.length > 5) this.recvtimes.shift();                          while (this.recvtimes.length > 5) this.recvtimes.shift();
230                  }                  }
231          }          }
232            this.updateSubsUrl();
233          this.setstatus(5);          this.setstatus(5);
234  }  }
235    

Legend:
Removed from v.22  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.26