Added 'connected' and 'disconnected' events.