77 |
}, |
}, |
78 |
|
|
79 |
connect: function() { |
connect: function() { |
|
Meteor.log("Connecting"); |
|
80 |
if (!Meteor.host) throw "Meteor host not specified"; |
if (!Meteor.host) throw "Meteor host not specified"; |
81 |
if (isNaN(Meteor.port)) throw "Meteor port not specified"; |
if (isNaN(Meteor.port)) throw "Meteor port not specified"; |
82 |
if (!Meteor.channelcount) throw "No channels specified"; |
if (!Meteor.channelcount) throw "No channels specified"; |
83 |
if (Meteor.status) Meteor.disconnect(); |
if (Meteor.status) Meteor.disconnect(); |
84 |
|
Meteor.log("Connecting"); |
85 |
Meteor.setstatus(1); |
Meteor.setstatus(1); |
86 |
if (!Meteor.hostid) Meteor.hostid = Meteor.time()+""+Math.floor(Math.random()*1000000) |
if (!Meteor.hostid) Meteor.hostid = Meteor.time()+""+Math.floor(Math.random()*1000000) |
87 |
document.domain = Meteor.extract_xss_domain(document.domain); |
document.domain = Meteor.extract_xss_domain(document.domain); |
107 |
|
|
108 |
disconnect: function() { |
disconnect: function() { |
109 |
if (Meteor.status) { |
if (Meteor.status) { |
110 |
|
if (Meteor.status != 6) Meteor.setstatus(0); |
111 |
|
Meteor.clearpoll(); |
112 |
clearTimeout(Meteor.pingtimer); |
clearTimeout(Meteor.pingtimer); |
113 |
clearTimeout(Meteor.updatepollfreqtimer); |
clearTimeout(Meteor.updatepollfreqtimer); |
114 |
clearTimeout(Meteor.frameloadtimer); |
clearTimeout(Meteor.frameloadtimer); |
115 |
if (typeof CollectGarbage == 'function') CollectGarbage(); |
if (typeof CollectGarbage == 'function') CollectGarbage(); |
|
if (Meteor.status != 6) Meteor.setstatus(0); |
|
116 |
Meteor.log("Disconnected"); |
Meteor.log("Disconnected"); |
117 |
try { Meteor.frameref.parentNode.removeChild(Meteor.frameref); delete Meteor.frameref; return true; } catch(e) { } |
try { Meteor.frameref.parentNode.removeChild(Meteor.frameref); delete Meteor.frameref; return true; } catch(e) { } |
118 |
try { Meteor.frameref.open(); Meteor.frameref.close(); return true; } catch(e) {} |
try { Meteor.frameref.open(); Meteor.frameref.close(); return true; } catch(e) {} |
320 |
}, |
}, |
321 |
|
|
322 |
clearpoll: function() { |
clearpoll: function() { |
323 |
var s = document.getElementById('meteorpoll'+Meteor.pollnum); |
if (document.getElementById('meteorpoll'+Meteor.pollnum)) { |
324 |
if (typeof s != 'undefined') s.parentNode.removeChild(s); |
var s = document.getElementById('meteorpoll'+Meteor.pollnum); |
325 |
if (Meteor.status) { |
s.parentNode.removeChild(s); |
326 |
|
} |
327 |
|
if (Meteor.status == 5) { |
328 |
var x = parent.Meteor.pollfreq - (Meteor.time()-Meteor.lastrequest); |
var x = parent.Meteor.pollfreq - (Meteor.time()-Meteor.lastrequest); |
329 |
if (x < 10) x = 10; |
if (x < 10) x = 10; |
330 |
setTimeout(Meteor.poll, x); |
setTimeout(Meteor.poll, x); |