Added connectionstate_updated callback

I added the connectionstate_updated callback, so we can track online/offline status, and act on connection interruptions.