Set reconnect=true, add error trace to help detect disconnects

Added to help resolve issue https://github.com/uProxy/uProxy/issues/224

Setting reconnect=true should result in the Client object automatically trying to reconnect to XMPP in case of an error.  I've also added error trace to offline, close, and end events in the client to help us debug if these occur.

I'm not sure how to force the XMPP network to disconnect me, so don't know the best way to test this.  Right now I've been able to trigger the close event by calling client.connection.socket.destroy().  I don't see the end or offline events being fired yet, but I think trace here is a good idea so we can better debug when logouts do occur.
thanks


On Wed, Jun 18, 2014 at 10:59 AM, Will <notifications@github.com> wrote:

> In src/socialprovider.js:
>
> > @@ -157,6 +158,23 @@ XMPPSocialProvider.prototype.connect = function(continuation) {
> >        delete this.client;
> >      }
> >    }.bind(this));
> > +  this.client.addListener('offline', function(e) {
> > +    // TODO: tell users of the API that this client is now offline,
> > +    // either by emitting an onClientState with OFFLINE using:
> > +    //   this.vCardStore.updateProperty(this.id, 'status', 'OFFLINE');
> > +    // or emit a new type of event, or invoke this.logout directly to
> > +    // clean things up.
> > +    console.error('received unhandled offline event', e);
>
> [image: :+1:]
> … <#146b022a62ec920d_>
> On Jun 18, 2014 7:56 PM, "dborkan" <notifications@github.com> wrote: In
> src/socialprovider.js: > @@ -157,6 +158,23 @@
> XMPPSocialProvider.prototype.connect = function(continuation) { > delete
> this.client; > } > }.bind(this)); > + this.client.addListener('offline',
> function(e) { > + // TODO: tell users of the API that this client is now
> offline, > + // either by emitting an onClientState with OFFLINE using: > +
> // this.vCardStore.updateProperty(this.id, 'status', 'OFFLINE'); > + //
> or emit a new type of event, or invoke this.logout directly to > + // clean
> things up. > + console.error('received unhandled offline event', e); Is it
> fine to just merge this as is for now? Adding onLogout seems like a bigger
> project and hard to test, and I'm hoping that by setting reconnect=true we
> may not even see any of these new offline/close/end traces — Reply to this
> email directly or view it on GitHub <
> https://github.com/freedomjs/freedom-social-xmpp/pull/49/files#r13929727>
> .
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/freedomjs/freedom-social-xmpp/pull/49/files#r13929966>
> .
>