Added 'offline' and 'reconnect' events.

Closes #112.