Fixed some bugs, changed the structure of events to onconnect() and ondisconnect() and added logging (stored in memory while offline).
Merge branch 'master' of https://github.com/electricimp/reference