Skip to content
Browse files

disabled socketDisconnect for ide

added afteronline/afteroffline events for ide
  • Loading branch information...
1 parent 036a48b commit ea21aee8bb4f539f869bbe39f5a56b6fe8c6f116 @linh81 linh81 committed Sep 14, 2011
Showing with 14 additions and 5 deletions.
  1. +13 −4 client/core/ide.js
  2. +1 −1 support/apf
View
17 client/core/ide.js
@@ -132,7 +132,7 @@ define(function(require, exports, module) {
}));
};
- ide.socketDisconnect = function() {
+ /*ide.socketDisconnect = function() {
clearTimeout(ide.$retryTimer);
var retries = 0;
@@ -144,8 +144,17 @@ define(function(require, exports, module) {
if (!sock.connecting && !sock.reconnecting && !ide.testOffline && ide.loggedIn)
sock.reconnect();
}, 1000);
- };
-
+ };*/
+
+ ide.addEventListener("afteroffline", function(){
+ ide.socket.socket.disconnect();
+ });
+
+ ide.addEventListener("afteronline", function(){
+ if (!ide.socket.connecting && !ide.socket.reconnecting && ide.loggedIn)
+ ide.socket.socket.connect();
+ });
+
ide.socketMessage = function(message) {
try {
message = JSON.parse(message);
@@ -209,7 +218,7 @@ define(function(require, exports, module) {
ide.socket.on("connect", ide.socketConnect);
//ide.socket.on("reconnect", ide.socketReconnect);
//ide.socket.on("reconnecting", ide.socketReconnecting);
- ide.socket.on("disconnect", ide.socketDisconnect);
+ //ide.socket.on("disconnect", ide.socketDisconnect);
var _oldsend = ide.socket.send;
ide.socket.send = function(msg) {
// pass a lambda to enable socket.io ACK
2 support/apf
@@ -1 +1 @@
-Subproject commit 20eeaff910f7fadeb445eeaa13867530937d8a37
+Subproject commit 232e4ca88db9688e5b8b9fd8f8ea3560bd872b58

0 comments on commit ea21aee

Please sign in to comment.
Something went wrong with that request. Please try again.