Skip to content

Commit 9c552c0

Browse files
committed
Merge pull request buddycloud#195 from buddycloud/avoid-reconnection
Avoid XMPP reconnection
2 parents 27bcf5b + c8817af commit 9c552c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/util/session.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ function createSession(req, res, next) {
156156
}
157157
}
158158
});
159+
160+
client.on('offline', function(error) {
161+
logger.error('Session went offline.');
162+
sessionCache.remove(req.credentials);
163+
for (var i = 0; i < session._waitingReqs.length; i++) {
164+
var wr = session._waitingReqs[i];
165+
wr['res'].send(503);
166+
}
167+
});
159168
}
160169

161170
function xmppConnectionOptions(req) {
@@ -174,7 +183,7 @@ function xmppConnectionOptions(req) {
174183
return {
175184
jid: '@' + domain,
176185
host: host,
177-
port: port,
186+
port: port
178187
//preferredSaslMechanism: 'ANONYMOUS'
179188
};
180189
}

0 commit comments

Comments
 (0)