web: Refactor disconnect event