owise1 / ambient-weather-api

Ambient Weather API
22 stars 8 forks source link

Resubscribe when Reconnect #2

Open bobbymccullough opened 6 years ago

bobbymccullough commented 6 years ago

I had an issue with Ambient Weather's system resetting (or something) each day around 4:15 my time. The app is one I wrote/hacked using both this wrapper's example and some code for my POST system. The app reconnects when AW resets but does not "resubscribe." I solved that so far by moving the subscribe portion up into the connect portion, it looks like this:

api1.connect() api1.on('connect', () => { console.log('Connected to Ambient Weather Realtime API!') api1.subscribe(apiKey) })