Emit an error event on socket connection loss