Refactoring WebSocket connection failure logic.

This completely decouples the connection failed event in kernel.js
from its handling in notificationarea.js.