Remove event listeners on reconnect.

Remove any listeners from the previous connection as they can cause
issues with messages being logged more than once.