47 |
Meteor.channels[channelname] = {backtrack:backtrack}; |
Meteor.channels[channelname] = {backtrack:backtrack}; |
48 |
Meteor.log("Joined channel "+channelname); |
Meteor.log("Joined channel "+channelname); |
49 |
Meteor.channelcount++; |
Meteor.channelcount++; |
50 |
if (Meteor.status != 0) Meteor.connect(); |
if (Meteor.status != 0 && Meteor.status != 6) Meteor.connect(); |
51 |
}, |
}, |
52 |
|
|
53 |
leaveChannel: function(channelname) { |
leaveChannel: function(channelname) { |
55 |
delete Meteor.channels[channelname]; |
delete Meteor.channels[channelname]; |
56 |
Meteor.log("Left channel "+channelname); |
Meteor.log("Left channel "+channelname); |
57 |
Meteor.channelcount--; |
Meteor.channelcount--; |
58 |
if (Meteor.channelcount && Meteor.status != 0) Meteor.connect(); |
if (Meteor.channelcount && Meteor.status != 0 && Meteor.status != 6) Meteor.connect(); |
59 |
else Meteor.disconnect(); |
else Meteor.disconnect(); |
60 |
}, |
}, |
61 |
|
|
85 |
Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/poll.html"); |
Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/poll.html"); |
86 |
Meteor.recvtimes[0] = t; |
Meteor.recvtimes[0] = t; |
87 |
if (Meteor.updatepollfreqtimer) clearTimeout(Meteor.updatepollfreqtimer); |
if (Meteor.updatepollfreqtimer) clearTimeout(Meteor.updatepollfreqtimer); |
88 |
if (Meteor.mode=='smartpoll') Meteor.updatepollfreqtimer = setInterval(Meteor.updatepollfreq, 2500); |
if (Meteor.mode=='smartpoll') Meteor.updatepollfreqtimer = setInterval(Meteor.updatepollfreq, 10000); |
89 |
if (Meteor.mode=='longpoll') Meteor.pollfreq = Meteor.minpollfreq; |
if (Meteor.mode=='longpoll') Meteor.pollfreq = Meteor.minpollfreq; |
90 |
} |
} |
91 |
Meteor.lastrequest = t; |
Meteor.lastrequest = t; |
98 |
clearTimeout(Meteor.frameloadtimer); |
clearTimeout(Meteor.frameloadtimer); |
99 |
if (typeof CollectGarbage == 'function') CollectGarbage(); |
if (typeof CollectGarbage == 'function') CollectGarbage(); |
100 |
if (Meteor.status != 6) Meteor.setstatus(0); |
if (Meteor.status != 6) Meteor.setstatus(0); |
|
try { |
|
|
Meteor.frameref.open(); |
|
|
Meteor.frameref.close(); |
|
|
} catch (e) { |
|
|
Meteor.frameref.parentNode.removeChild(Meteor.frameref); |
|
|
} |
|
|
delete Meteor.frameref; |
|
101 |
Meteor.log("Disconnected"); |
Meteor.log("Disconnected"); |
102 |
|
try { Meteor.frameref.parentNode.removeChild(Meteor.frameref); delete Meteor.frameref; return true; } catch(e) { } |
103 |
|
try { Meteor.frameref.open(); Meteor.frameref.close(); return true; } catch(e) {} |
104 |
} |
} |
105 |
}, |
}, |
106 |
|
|
167 |
|
|
168 |
pollmode: function() { |
pollmode: function() { |
169 |
Meteor.log("Ping timeout"); |
Meteor.log("Ping timeout"); |
170 |
Meteor.mode="smartpoll"; |
if (Meteor.mode != "smartpoll") { |
171 |
clearTimeout(Meteor.pingtimer); |
Meteor.mode="smartpoll"; |
172 |
Meteor.callbacks["changemode"]("poll"); |
Meteor.callbacks["changemode"]("poll"); |
173 |
Meteor.lastpingtime = false; |
clearTimeout(Meteor.pingtimer); |
174 |
|
Meteor.lastpingtime = false; |
175 |
|
} |
176 |
Meteor.connect(); |
Meteor.connect(); |
177 |
}, |
}, |
178 |
|
|
204 |
}, |
}, |
205 |
|
|
206 |
reset: function() { |
reset: function() { |
207 |
if (Meteor.status != 6) { |
if (Meteor.status != 6 && Meteor.status != 0) { |
208 |
Meteor.log("Stream reset"); |
Meteor.log("Stream reset"); |
209 |
Meteor.ping(); |
Meteor.ping(); |
210 |
Meteor.callbacks["reset"](); |
Meteor.callbacks["reset"](); |