kh90909 / OakTerm

Serial terminal for the Digistump Oak over the Particle Cloud
8 stars 2 forks source link

Errors from the EventStream object returned by particle.getEventStream are not handled (e.g. if the stream dies, we don't detect it) #71

Open kh90909 opened 8 years ago

kh90909 commented 8 years ago

This issue can be reproduced in Chrome by temporarily switching network throttling to offline until you see a GET error in the console from https://api.particle.io/v1/devices/:deviceid/events.... If you turn off throttling at this point, events are no longer be received.

I tried adding a stream.on('error', ... handler to display_event():

    activeStream.on('error', function(err) {
      console.log('Subscribed event stream terminated with error. Attempting to restart.');
      activeStream.active = false;
      Promise.resolve()
        .retry(subscribe_events,retry_conditional,1)
        .then(display_event)
        .catch(error_handler);
    });

but this didn't seem to be called at all. It's possible that there's a bug in ParticleJS such that it doesn't actually pass on errors to the EventStream object.