/[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 18 by andrew.betts, Wed May 2 10:55:26 2007 UTC revision 19 by andrew.betts, Wed May 2 11:21:14 2007 UTC
# Line 23  function Meteor(instID) { Line 23  function Meteor(instID) {
23          this.pingtimer = false;          this.pingtimer = false;
24          this.updatepollfreqtimer = false;          this.updatepollfreqtimer = false;
25          this.lastrequest = 0;          this.lastrequest = 0;
26          this.recvtimes = new Array();          this.recvtimes = [];
27          this.MHostId = false;          this.MHostId = false;
28          this.callback_process = function() {};          this.callback_process = function() {};
29          this.callback_reset = function() {};          this.callback_reset = function() {};
# Line 34  function Meteor(instID) { Line 34  function Meteor(instID) {
34          this.frameloadtimer = false;          this.frameloadtimer = false;
35          this.debugmode = false;          this.debugmode = false;
36          this.subsurl = false;          this.subsurl = false;
37            this.channels = {};
38    
39          // Documented public properties          // Documented public properties
         this.channels = new Array();  
40          this.subdomain = "data";          this.subdomain = "data";
41          this.dynamicpageaddress = "push";          this.dynamicpageaddress = "push";
42          this.smartpoll = true;          this.smartpoll = true;
# Line 90  Meteor.reset = function(ifr) { Line 90  Meteor.reset = function(ifr) {
90  Meteor.prototype.joinChannel = function(channelname, backtrack) {  Meteor.prototype.joinChannel = function(channelname, backtrack) {
91          if (typeof(this.channels[channelname]) != "undefined") throw "Cannot join channel "+channelname+": already subscribed";          if (typeof(this.channels[channelname]) != "undefined") throw "Cannot join channel "+channelname+": already subscribed";
92          this.channels[channelname] = {backtrack:backtrack, lastmsgreceived:0};          this.channels[channelname] = {backtrack:backtrack, lastmsgreceived:0};
93            if (this.debugmode) console.log("Joined channel "+channelname+", channel list follows");
94            if (this.debugmode) console.log(this.channels);
95          if (this.status != 0) this.start();          if (this.status != 0) this.start();
96  }  }
97    
# Line 194  Meteor.prototype.pollmode = function() { Line 196  Meteor.prototype.pollmode = function() {
196  }  }
197    
198  Meteor.prototype.process = function(id, channel, data) {  Meteor.prototype.process = function(id, channel, data) {
199          if (id > this.channels[channel].lastmsgreceived) {          if (id == -1) {
200                  if (this.debugmode) console.log("Message "+id+" received on channel "+channel+": "+data);                  if (this.debugmode) console.log("Ping");
201                    this.ping();
202            } else if (typeof(this.channels[channel]) != "undefined" && id > this.channels[channel].lastmsgreceived) {
203                    if (this.debugmode) console.log("Message "+id+" received on channel "+channel+" (last id on channel: "+this.channels[channel].lastmsgreceived+")\n"+data);
204                  this.callback_process(data);                  this.callback_process(data);
205                  this.channels[channel].lastmsgreceived = id;                  this.channels[channel].lastmsgreceived = id;
206                  if (this.mode=="poll") {                  if (this.mode=="poll") {
# Line 204  Meteor.prototype.process = function(id, Line 209  Meteor.prototype.process = function(id,
209                          this.recvtimes[this.recvtimes.length] = t;                          this.recvtimes[this.recvtimes.length] = t;
210                          while (this.recvtimes.length > 5) this.recvtimes.shift();                          while (this.recvtimes.length > 5) this.recvtimes.shift();
211                  }                  }
         } else if (id == -1) {  
                 if (this.debugmode) console.log("Ping");  
                 this.ping();  
212          }          }
213          this.setstatus(5);          this.setstatus(5);
214  }  }

Legend:
Removed from v.18  
changed lines
  Added in v.19

  ViewVC Help
Powered by ViewVC 1.1.26