Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
fix(hub): Disconnect issue (MAX_CLIENTS=6)
Browse files Browse the repository at this point in the history
- Add error handler to the XMPP 'login' client
- Reject promises in both error handlers
- Enable auto-reconnection
  • Loading branch information
patters authored and swissmanu committed Dec 6, 2018
1 parent 36301a4 commit 8e50b99
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/#/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ function getIdentity (hubhost, hubport) {
})

xmppClient.on('error', function (e) {
debug('XMPP client error')
console.log('errorhub', e)
debug('XMPP client error', e)
xmppClient.end()
deferred.reject(e)
})

xmppClient.on('stanza', function (stanza) {
Expand Down Expand Up @@ -101,6 +102,12 @@ function loginWithIdentity (identity, hubhost, hubport) {
disallowTLS: true
})

xmppClient.on('error', function (e) {
debug('XMPP login error', e)
xmppClient.end()
deferred.reject(e)
})

xmppClient.once('online', function () {
debug('XMPP client connected using identity token')
deferred.resolve(xmppClient)
Expand Down

0 comments on commit 8e50b99

Please # to comment.